Skip to content

Commit 502c4b3

Browse files
committed
fix(material/slider): incorrectly inheriting color when nested inside component with theme
The slider theme selectors were a bit too broad which meant that it would automatically inherit the colors from a parent component, if the Material theming classes were used somewhere up the chain (e.g. a slider inside a tab group). These changes use more specific selectors to avoid the issue. Fixes #21271.
1 parent 71b7b15 commit 502c4b3

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/material/slider/_slider-theme.scss

+12-10
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,18 @@
4747
background-color: $mat-slider-off-color;
4848
}
4949

50-
.mat-primary {
51-
@include _mat-slider-inner-content-theme($primary);
52-
}
50+
.mat-slider {
51+
&.mat-primary {
52+
@include _mat-slider-inner-content-theme($primary);
53+
}
5354

54-
.mat-accent {
55-
@include _mat-slider-inner-content-theme($accent);
56-
}
55+
&.mat-accent {
56+
@include _mat-slider-inner-content-theme($accent);
57+
}
5758

58-
.mat-warn {
59-
@include _mat-slider-inner-content-theme($warn);
59+
&.mat-warn {
60+
@include _mat-slider-inner-content-theme($warn);
61+
}
6062
}
6163

6264
.mat-slider:hover,
@@ -66,7 +68,7 @@
6668
}
6769
}
6870

69-
.mat-slider-disabled {
71+
.mat-slider.mat-slider-disabled {
7072
.mat-slider-track-background,
7173
.mat-slider-track-fill,
7274
.mat-slider-thumb {
@@ -80,7 +82,7 @@
8082
}
8183
}
8284

83-
.mat-slider-min-value {
85+
.mat-slider.mat-slider-min-value {
8486
.mat-slider-focus-ring {
8587
$opacity: 0.12;
8688
$color: mat-color($foreground, base, $opacity);

0 commit comments

Comments
 (0)