Creating a CSS ripple effect using a pseudo-element that triggers a reflow

I'm currently working on creating the material ripple effect using styled-components, since importing the material web-components mixins is not possible. I am specifically focusing on maintaining the accessibility tree by utilizing the after element for the foreground effect.

Unfortunately, I have noticed that on mobile devices, there is a reflow issue with the button's content due to the ripple transition. This seems to be triggered by the display change from none to block. Despite trying alternative solutions to mitigate this artifact, the side-effect persists.

Below is my code snippet (I use props to configure the ripple, but feel free to set them manually for testing purposes): [Outdated code version was here]

Thank you for your attention.

Edit: Strangely, the bug only occurs when a hover effect is added to the button. Below is the link and code sample (please note that setting up a react repository is required to reproduce it)

https://github.com/Eduardogbg/ripple-hover-reflow-bug

import React, { useRef, useReducer } from 'react';
import ReactDOM from 'react-dom';
import styled from 'styled-components'

const ButtonBase = styled.button`
  // Styling details
`

// More code continues below...

Answer №1

It appears that the issue is connected to a known chromium bug that was supposedly resolved several years ago: Image shifts when filter changes in Chrome

Adding transform: translate3d(0,0,0); seems to provide a solution, although it may not be completely precise.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Developing an editor

Currently, I am delving into the concept of object inheritance in JavaScript through a practical exercise where I am creating an online editor similar to the one I am currently using. However, I find myself slightly confused as I aim to utilize data-* att ...

Creating double borders on a single element without using a wrapping div is possible using only CSS

I am attempting to create a specific effect using just one element, aiming to eliminate the need for a wrapper div. Check out my progress so far: http://codepen.io/anon/pen/kdvex Although I have come close to achieving the desired effect by incorporating ...

"Exploring the Power of Jsoup for Selecting

I'm attempting to extract all the links nested within the div class news column index. Here is a snippet of the HTML structure: https://i.stack.imgur.com/zdFWS.jpg Below is the code I have used, but unfortunately, it's not yielding any results. ...

Use Styled-Components to define the appearance of child elements when their parent is hovered over

I have a straightforward element There are two variations of it - one using styled-components and the other without: No Styled Components <div id="box"> <div id="inner-box"></div> </div> #box { width: 100px; height: ...

Guide on Sharing Content (Across Several Peers) via Webrtc and Firebase

After successfully using Firebase with WebRTC to create a one-to-one video-audio calling web app, I now aim to develop a one-to-several peer broadcasting system (similar to Twitch). However, I came across an outdated resource on how to do this using WebRTC ...

Material UI - Panel Expansion does not cause the div above to resize

Scenario : Utilizing leaflet and React-table together in one component. Two divs stacked vertically - one containing a leaflet map and the other a react-table. The second div has Expansion Panels with react-table inside. Issue : Problem arises when ...

What measures can be taken to stop LESS partials from compiling independently?

When working with LESS, I utilize partials that are included (@include) into the main LESS stylesheet. A common issue I face is that each partial ends up compiling to its own CSS file, leading to project clutter. In SASS, if a file is named with an unders ...

Tips on sending a chosen value as a parameter to the helper function

Is there a way to update the state based on the selected value, or how can I pass the selected value as an argument to the helper method? class SelectParker extends Component { state = { selectedValue: "", values: [], }; componentD ...

What is the best way to display photos horizontally instead of vertically on a webpage?

Is there a way to display these photos (found at ) in a row instead of a column? Can someone provide instructions on how to achieve this? Additionally, should I use one div for all the images or create a separate div for each image? Furthermore, it would ...

The React Hook useEffect is triggering a warning about missing dependencies related to 'classes'. This issue involves the Material-ui styles and react-bootstrap-sweetalert

Upon encountering this warning: "React Hook useEffect has missing dependencies: 'classes.button' and 'classes.warning'.", it became clear that I needed to address the issue at hand. As per the recommended usage of react-bootstrap-sweeta ...

Problem with the spacing in the Bootstrap website after the breadcrumbs due to flexbox issues

I'm facing a challenge with one of my Bootstrap-based pages that I can't quite figure out. We recently implemented breadcrumbs for navigation, which is also built with Bootstrap. However, some pages are displaying a significant gap between the br ...

Styling will_paginate Links in Rails 3 - A Guide

When it comes to coding layout, how should the link be styled? <a href="#" class="class1 class2 class3"><span>Previous</span></a> <a href="#" class="class1 class2 class3"><span>Next</span> In my search for a solu ...

SassError: Variable not defined

I have a file containing variables with different themes that I need to override: _vars.scss body { $bg-color: #fff } body.theme-dark { $bg-color: #333 } In my Angular button component, I am referencing these variables: button.scss @import '_va ...

What is the best way to trigger an action with router v6.4 in conjunction with Redux?

Check out the code below: //main.jsx with router const router = createBrowserRouter([{ path: "/login", element: <LoginPage/>, errorElement: <ErrorPage/>, action: loginAction }, { path: "*", element: ...

Learn how to create a series of table rows using CSS, followed by another series of table rows

I have an array of tables, each with a size of 6 x 6, and a placeholder. My goal is to arrange these tables in the placeholder so that they appear in rows of 6 next to each other. I am unsure about which CSS properties to apply to achieve this layout. Lit ...

Struggling with Third-Party Cookies Restriction in Next.js App Integrated with Clerk Authentication

I recently started following a tutorial on YouTube titled "Creating an SaaS AI Platform using next.js 13, React, Tailwind, Prisma, and Stripe". However, I've encountered some issues with third-party cookies being blocked. On my landing page, I have a ...

Using the back button in the browser can undo any CSS modifications made by JavaScript

I'm currently working on a form that changes the displayed select lists based on the selection of a previous list. HTML <select name="college" id="college" onchange="show_majors()"> <!-- <option value="-">-</option& ...

jQuery loads browser cache to override transitions in the body class

My .load ajax function: 1) Click link 2) The requested page loads with a smooth css transition animation (applying/removing body classes) 3) If the page loads faster than 400ms, it should wait before revealing the page by removing the body class While ...

Flex container has images stretched, but align-self-center cannot be utilized

Looking for a solution to resolve an issue with the following Bootstrap 4 markup: <div class="col-3 d-flex flex-column"> <img class="align-self-center" src="#"/> </div> The problem arises when using align-self-center in a flex conta ...

When you hover over an image, its opacity will change and text will overlay

I am looking for a way to decrease the opacity and overlay text on a thumbnail image when it is hovered over. I have considered a few methods, but I am concerned that they may not be efficient or elegant. Creating a duplicated image in Photoshop with the ...