Skip to content

Commit c869e56

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 7cc42f5 commit c869e56

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
@@ -52,16 +52,18 @@
5252
background-color: $mat-slider-off-color;
5353
}
5454

55-
.mat-primary {
56-
@include _inner-content-theme($primary);
57-
}
55+
.mat-slider {
56+
&.mat-primary {
57+
@include _inner-content-theme($primary);
58+
}
5859

59-
.mat-accent {
60-
@include _inner-content-theme($accent);
61-
}
60+
&.mat-accent {
61+
@include _inner-content-theme($accent);
62+
}
6263

63-
.mat-warn {
64-
@include _inner-content-theme($warn);
64+
&.mat-warn {
65+
@include _inner-content-theme($warn);
66+
}
6567
}
6668

6769
.mat-slider:hover,
@@ -71,7 +73,7 @@
7173
}
7274
}
7375

74-
.mat-slider-disabled {
76+
.mat-slider.mat-slider-disabled {
7577
.mat-slider-track-background,
7678
.mat-slider-track-fill,
7779
.mat-slider-thumb {
@@ -85,7 +87,7 @@
8587
}
8688
}
8789

88-
.mat-slider-min-value {
90+
.mat-slider.mat-slider-min-value {
8991
.mat-slider-focus-ring {
9092
$opacity: 0.12;
9193
$color: theming.get-color-from-palette($foreground, base, $opacity);

0 commit comments

Comments
 (0)