Skip to content

Commit be0f17e

Browse files
crisbetojelbourn
authored andcommitted
fix(select, autocomplete): no indication of active option in high contrast mode. (#10229)
Fixes users in high contrast mode not being able to distinguish the active option from all the other options. Fixes #10207.
1 parent 3f8523c commit be0f17e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/lib/core/option/option.scss

+17
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,23 @@
2727
padding-right: $mat-menu-side-padding * 2;
2828
}
2929
}
30+
31+
@include cdk-high-contrast {
32+
$high-contrast-border-width: 1px;
33+
34+
// Add a margin to offset the border that we're adding to active option, in order
35+
// to avoid the options shifting as the user is moving through the list.
36+
margin: 0 $high-contrast-border-width;
37+
38+
&.mat-active {
39+
// We use a border here, rather than an outline, because the outline will be cut off
40+
// by the `overflow: hidden` on the panel wrapping the options, whereas a border
41+
// will push the element inwards. This could be done using `outline-offset: -1px`,
42+
// however the property isn't supported on IE11.
43+
border: solid $high-contrast-border-width currentColor;
44+
margin: 0;
45+
}
46+
}
3047
}
3148

3249
// Collapses unwanted whitespace created by newlines in code like the following:

0 commit comments

Comments
 (0)