Skip to content

Commit 23b4c88

Browse files
authored
fix(material-experimental/mdc-core): active option not visible in high contrast mode (#20396)
The active option indication wasn't visible in high contrast mode, because it's based on the option's background color.
1 parent 169ebc4 commit 23b4c88

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/material-experimental/mdc-core/option/option.scss

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,25 @@
5656
}
5757
}
5858
}
59+
60+
.mat-mdc-option-active {
61+
@include cdk-high-contrast(active, off) {
62+
// A pseudo element is used here, because the active indication gets moved between options
63+
// and we don't want the border from below to shift the layout around as it's added and removed.
64+
&::before {
65+
content: '';
66+
position: absolute;
67+
top: 0;
68+
bottom: 0;
69+
left: 0;
70+
right: 0;
71+
pointer-events: none;
72+
73+
// We use a border here, rather than an outline, because the outline will be cut off
74+
// by the `overflow: hidden` on the panel wrapping the options, whereas a border
75+
// will push the element inwards. This could be done using `outline-offset: -1px`,
76+
// however the property isn't supported on IE11.
77+
border: solid 1px currentColor;
78+
}
79+
}
80+
}

0 commit comments

Comments
 (0)