Description
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 is position: 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 to true
What is the current behavior?
.mat-ripple
elements are rendered in the DOM and consume memory
What 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.