Skip to content

Commit 3f1e960

Browse files
crisbetojosephperrott
authored andcommitted
fix(form-field): native select options blending in with dropdown background on a dark theme (#13201)
1 parent 675aa66 commit 3f1e960

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/lib/input/_input-theme.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@
2626
@include input-placeholder {
2727
color: _mat-control-placeholder-color($theme);
2828
}
29+
30+
// On dark themes we set the native `select` color to some shade of white,
31+
// however the color propagates to all of the `option` elements, which are
32+
// always on a white background inside the dropdown, causing them to blend in.
33+
// Since we can't change background of the dropdown, we need to explicitly
34+
// reset the color of the options to something dark.
35+
@if (map-get($theme, is-dark)) {
36+
option {
37+
color: $dark-primary-text;
38+
}
39+
40+
option:disabled {
41+
color: $dark-disabled-text;
42+
}
43+
}
2944
}
3045

3146
.mat-accent .mat-input-element {

0 commit comments

Comments
 (0)