Skip to content

Commit 4b493bc

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 ac97157 commit 4b493bc

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
@@ -52,6 +52,16 @@ $mat-radio-ripple-radius: 20px;
5252
._mat-animation-noopable & {
5353
transition: none;
5454
}
55+
56+
// Note that this creates a square box around the circle, however it's consistent with
57+
// how IE/Edge treat native radio buttons in high contrast mode. We can't turn the border
58+
// into a dotted one, because it's too thick which causes the circles to look off.
59+
@include cdk-high-contrast {
60+
.mat-radio-button.cdk-keyboard-focused & {
61+
outline: dotted 1px;
62+
}
63+
}
64+
5565
}
5666

5767
// The inner circle for the radio, shown when checked.
@@ -141,7 +151,7 @@ $mat-radio-ripple-radius: 20px;
141151
opacity: 0.04;
142152
}
143153

144-
.mat-radio-button.cdk-focused & {
154+
.mat-radio-button.cdk-keyboard-focused & {
145155
opacity: 0.12;
146156
}
147157

0 commit comments

Comments
 (0)