Skip to content

Commit bbd30fb

Browse files
crisbetoandrewseguin
authored andcommitted
fix(form-field): select value text blending in with the background in high contrast mode (#15286)
Fixes the selected value text of a native `select` inside a `mat-form-field` blending in with the background, if the form field is focused in high contrast mode.
1 parent bd1c973 commit bbd30fb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/lib/form-field/form-field-input.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@import '../core/style/variables';
22
@import '../core/style/vendor-prefixes';
3+
@import '../../cdk/a11y/a11y';
34

45
// The Input element proper.
56
.mat-input-element {
@@ -169,6 +170,16 @@ select.mat-input-element {
169170
// We need to reset the `color` as well, because IE sets it to white.
170171
color: inherit;
171172
background: none;
173+
174+
// IE and Edge in high contrast mode reset the color for a focused select to the same color
175+
// as the background, however this causes it blend in because we've reset the `background`
176+
// above. We have to add a more specific selector in order to ensure that it gets the
177+
// `color` from our theme instead.
178+
@include cdk-high-contrast {
179+
.mat-focused & {
180+
color: inherit;
181+
}
182+
}
172183
}
173184
}
174185

0 commit comments

Comments
 (0)