Skip to content

Commit 7af9fc0

Browse files
committed
fix(radio): missing radio indication in high contrast mode
Currently we use ripples for focus indication on radio buttons, however they're hidden in high contrast mode. These changes add an outline as a fallback. Also fixes the focus indication showing up for mouse focus.
1 parent d22f48c commit 7af9fc0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/lib/radio/radio.scss

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ $mat-radio-ripple-radius: 20px;
5353
._mat-animation-noopable & {
5454
transition: none;
5555
}
56+
57+
// Note that this creates a square box around the circle, however it's consistent with
58+
// how IE/Edge treat native radio buttons in high contrast mode. We can't turn the border
59+
// into a dotted one, because it's too thick which causes the circles to look off.
60+
@include cdk-high-contrast {
61+
.mat-radio-button.cdk-keyboard-focused & {
62+
outline: dotted 1px;
63+
}
64+
}
65+
5666
}
5767

5868
// The inner circle for the radio, shown when checked.
@@ -142,7 +152,7 @@ $mat-radio-ripple-radius: 20px;
142152
opacity: 0.04;
143153
}
144154

145-
.mat-radio-button:not(.mat-radio-disabled).cdk-focused & {
155+
.mat-radio-button:not(.mat-radio-disabled).cdk-keyboard-focused & {
146156
opacity: 0.12;
147157
}
148158

0 commit comments

Comments
 (0)