-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disabled ripple in buttons are still rendered in the DOM, taking up memory #12647
Comments
We had a related discussion about this in one my PRs. See #8864. There should be a discussion about this before we start going on specific way. |
Events overhead aside, there's also a browser memory overhead, when disabled ripple elements remain in the DOM, as explained above. The short of it is that every ripple elements is painted on it's own DOM layer, bulking up the memory. Therefore ,disabled ripples should at least have their position: absolute changed to position: unset in order to spare the extra layers. |
I have the same issue as @bsteffl |
Closing this since we don't plan to change the ripple specifically for this. As we continue to align our implementation with MDC, I do expect to see more changes to the ripple rendering, though. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
When using
[disableRipple]
on mat-button, the ripple effect is indeed disabled, but the ripple DOM element is still rendered. Since the CSS of ripple elements isposition: absolute
, each ripple instance is elevated to its own layer. Each layer consumes +15KB of memory. This is waste of precious browser memory. Sometimes there is an additional layer created to deal with overlapping elements, taking yet more memory. I exemplify below.What is the expected behavior?
.mat-ripple
elements should not be rendered in the DOM when[disableRipple]
is set totrue
What is the current behavior?
.mat-ripple
elements are rendered in the DOM and consume memoryWhat are the steps to reproduce?
Set a mat-button to disable ripple effect using
[disableRipple]="true"
. Open Chrome or Safari's devTools and go to Layers panel. Inspect the button and see that its ripple is present, and is elevated to its own layer. See in the bottom panel how much memory that layer consumes.What is the use-case or motivation for changing an existing behavior?
Improve performance
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Material 6.3.3, Angular 6.0.4
Example
I attached example images showing a list of 5 items, each has a button with ripple disabled. 5 x ~20KB is roughly 100KB of browser memory taken for nothing.
Material ripple layers as is

Material ripple layers, with

position: absolute
removedThe text was updated successfully, but these errors were encountered: