question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ripple is broken on elements with `display: none` on page load

See original GitHub issue

What MDC-Web Version are you using?

0.12.1

What browser(s) is this bug affecting?

Google Chrome Version 57.0.2987.133 (64-bit) Mozilla Firefox Version 52.0.2 (64-bit) Others not tested.

What OS are you using?

Arch Linux Kernel 4.10.8-1

What are the steps to reproduce the bug?

  1. Open this codepen: https://codepen.io/draoncc/pen/OgLrjN
  2. Observe the behaviour of ripples on the buttons.

Note: Alternatively to setting the display state to ‘none’ by script the behaviour can be reproduced by setting an inline style of display: none on the ripple element to break.

What is the expected behavior?

Both buttons have working ripples regardless of “initial” display state.

What is the actual behavior?

The ripple on the #broken-button, which’s style is set to display: none on run of the script, does not work properly.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
anton-kachurincommented, Jul 13, 2017

It works either way.

In your case, call document.querySelector('#button').MDCRipple.layout() after changing display property of the button.

0reactions
kfranqueirocommented, Aug 7, 2017

As @anton-kachurin mentioned, layout is now also exposed at the component level on mdc-ripple, which makes this issue resolvable by calling layout on ripples when your element is no longer display: none. As such, I’m going to close this issue.

If anyone still encounters problems particular to a specific use case, please enter a new issue if you think there is something that material-components-web needs to do to resolve it. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

jquery - Ripples Effect not Showing, How Can I Fix?
It looks like the two scripts (the one for JQuery and the one for Ripples) are not present on the home page of...
Read more >
ion-ripple-effect - Ionic Framework
The ripple effect component adds the Material Design ink ripple interaction effect. This component can only be used inside of an <ion-app> and...
Read more >
Visibility hidden vs display none – What is the difference in CSS
When visibility:hidden is applied to an HTML element, it is not visible in the page, which makes sense. But the critical thing to...
Read more >
Populating the page: how browsers work - Web Performance
Web performance is what we have to do to make the page load happen as quickly as ... and its children and any...
Read more >
Ripples | Angular Material
By default, a ripple is activated when the host element of the matRipple directive receives mouse or touch events. Upon being pressed, a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found