Skip to content

Commit 31f0483

Browse files
committed
perf(ripple): contain layout, paint and style calculations to ripple container
Uses [CSS containment](https://developer.mozilla.org/en-US/docs/Web/CSS/contain) to contain the various layout and style calculations to the ripple container since they're independent of the rest of the page.
1 parent e9466a4 commit 31f0483

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/lib/core/ripple/_ripple.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@ $mat-ripple-color-opacity: 0.1;
1010
.mat-ripple {
1111
overflow: hidden;
1212

13+
// Limit style recalculations to the ripple container, as much as possible.
14+
contain: strict;
15+
1316
// By default, every ripple container should have position: relative in favor of creating an
1417
// easy API for developers using the MatRipple directive.
1518
position: relative;
1619
}
1720

1821
.mat-ripple.mat-ripple-unbounded {
22+
// For unbounded ripples we can't contain `paint`,
23+
// because it stops `overflow` from working.
24+
contain: size layout style;
1925
overflow: visible;
2026
}
2127

0 commit comments

Comments
 (0)