Skip to content

Commit 1a60a7a

Browse files
crisbetommalerba
authored andcommitted
fix(select,autocomplete): mat-option theme not being applied correctly when nested inside a selector (#10889)
Fixes the theme for the individual `mat-option` instances producing the wrong selector when it's nested inside a selector, e.g. ```scss .dark-theme { @include angular-material-theme($dark-theme); } ```
1 parent d2b183e commit 1a60a7a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/lib/core/option/_option-theme.scss

+12-12
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,6 @@
1717
background: mat-color($background, hover);
1818
}
1919

20-
.mat-primary &.mat-selected:not(.mat-option-disabled) {
21-
color: mat-color($primary);
22-
}
23-
24-
.mat-accent &.mat-selected:not(.mat-option-disabled) {
25-
color: mat-color($accent);
26-
}
27-
28-
.mat-warn &.mat-selected:not(.mat-option-disabled) {
29-
color: mat-color($warn);
30-
}
31-
3220
// In multiple mode there is a checkbox to show that the option is selected.
3321
&.mat-selected:not(.mat-option-multiple):not(.mat-option-disabled) {
3422
background: mat-color($background, hover);
@@ -43,6 +31,18 @@
4331
color: mat-color($foreground, hint-text);
4432
}
4533
}
34+
35+
.mat-primary .mat-option.mat-selected:not(.mat-option-disabled) {
36+
color: mat-color($primary);
37+
}
38+
39+
.mat-accent .mat-option.mat-selected:not(.mat-option-disabled) {
40+
color: mat-color($accent);
41+
}
42+
43+
.mat-warn .mat-option.mat-selected:not(.mat-option-disabled) {
44+
color: mat-color($warn);
45+
}
4646
}
4747

4848
@mixin mat-option-typography($config) {

0 commit comments

Comments
 (0)