Skip to content

Commit b4a9c62

Browse files
crisbetojelbourn
authored andcommitted
fix(checkbox): incorrect ripple color when unchecked (#13569)
Currently no matter whether the checkbox is checked, its ripple always uses the theme color. These changes align it with the other components and the spec where the ripple is the base color when unchecked.
1 parent 6643735 commit b4a9c62

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/material/checkbox/_checkbox-theme.scss

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,24 @@
9292
}
9393
}
9494

95-
.mat-checkbox:not(.mat-checkbox-disabled) {
96-
&.mat-primary .mat-checkbox-ripple .mat-ripple-element {
97-
background-color: mat-color($primary);
95+
// Switch this to a solid color since we're using `opacity`
96+
// to control how opaque the ripple should be.
97+
.mat-checkbox .mat-ripple-element {
98+
background-color: map_get(map-get($theme, foreground), base);
99+
}
100+
101+
.mat-checkbox-checked:not(.mat-checkbox-disabled),
102+
.mat-checkbox:active:not(.mat-checkbox-disabled) {
103+
&.mat-primary .mat-ripple-element {
104+
background: mat-color($primary);
98105
}
99106

100-
&.mat-accent .mat-checkbox-ripple .mat-ripple-element {
101-
background-color: mat-color($accent);
107+
&.mat-accent .mat-ripple-element {
108+
background: mat-color($accent);
102109
}
103110

104-
&.mat-warn .mat-checkbox-ripple .mat-ripple-element {
105-
background-color: mat-color($warn);
111+
&.mat-warn .mat-ripple-element {
112+
background: mat-color($warn);
106113
}
107114
}
108115
}

0 commit comments

Comments
 (0)