Skip to content

disabled ripple in buttons are still rendered in the DOM, taking up memory #12647

Closed
@AsafAgranat

Description

@AsafAgranat

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.

Material ripple layers as is
material ripple disabled

Material ripple layers, with position: absolute removed
material ripple forced to display none

Metadata

Metadata

Assignees

Labels

P5The team acknowledges the request but does not plan to address it, it remains open for discussionarea: material/coreneeds: discussionFurther discussion with the team is needed before proceedingperfThis issue is related to performance

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions