Skip to content

Commit ae968ab

Browse files
authored
fix(material/radio): hidden circle visible on some zoom levels (#22066)
We transition the circle of a radio button to `scale(0.001)` in order to hide it and to work around an animation in IE. It seems that on higher system zoom levels (e.g. 125%+) the browser approximates the size to 1x1 which can be visible. These changes work around the issue by also setting `opacity: 0` while the circle is inactive and isn't animating. Fixes #22036.
1 parent d733ee2 commit ae968ab

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/material/radio/radio.scss

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,20 @@ $ripple-radius: 20px;
6767

6868
// The inner circle for the radio, shown when checked.
6969
.mat-radio-inner-circle {
70+
$transition-duration: 280ms;
71+
$base-transition: transform ease $transition-duration, background-color ease $transition-duration;
7072
border-radius: 50%;
7173
box-sizing: border-box;
7274
display: block;
7375
height: $size;
7476
left: 0;
7577
position: absolute;
7678
top: 0;
77-
transition: transform ease 280ms, background-color ease 280ms;
79+
// On some zoom levels the `scale(0.001)` from below can cause the circle to be shown as a 1x1
80+
// dot (see #22036). Ensure that it's hidden using `opacity`. There's a slight transition with
81+
// a long delay so that switching the opacity only applies after the `transform` is done.
82+
opacity: 0;
83+
transition: $base-transition, opacity linear 1ms $transition-duration;
7884
width: $size;
7985

8086
// Note: This starts from 0.001 instead of 0, because transitioning from 0 to 0.5 causes
@@ -90,6 +96,8 @@ $ripple-radius: 20px;
9096

9197
.mat-radio-checked & {
9298
transform: scale(0.5);
99+
opacity: 1;
100+
transition: $base-transition;
93101

94102
@include a11y.high-contrast(active, off) {
95103
// Since we use a background color to render the circle, it won't be

0 commit comments

Comments
 (0)