Skip to content

Commit 7f234fb

Browse files
committed
fix(checkbox): incorrect ripple color when unchecked
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 2dff301 commit 7f234fb

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/lib/checkbox/_checkbox-theme.scss

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,24 @@
9090
}
9191
}
9292

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

98-
&.mat-accent .mat-checkbox-ripple .mat-ripple-element {
99-
background-color: mat-color($accent);
105+
&.mat-accent .mat-ripple-element {
106+
background: mat-color($accent);
100107
}
101108

102-
&.mat-warn .mat-checkbox-ripple .mat-ripple-element {
103-
background-color: mat-color($warn);
109+
&.mat-warn .mat-ripple-element {
110+
background: mat-color($warn);
104111
}
105112
}
106113
}

0 commit comments

Comments
 (0)