Skip to content

Commit 1328da7

Browse files
crisbetoatscott
authored andcommitted
fix(radio): don't show hover ripples on touch devices (angular#13701)
On touch devices `:hover` styling persists after the user has tapped. These changes hide the persistent ripple if the user isn't able to hover, in order to avoid confusion with the other ripples. Related to angular#13675.
1 parent b43b3e0 commit 1328da7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/lib/radio/radio.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,16 @@ $mat-radio-ripple-radius: 20px;
151151
&, .mat-radio-disabled .mat-radio-container:hover & {
152152
opacity: 0;
153153
}
154+
155+
// Hover styles will be displayed after tapping on touch devices.
156+
// Disable the hover styling if the user's device doesn't support hovering.
157+
@media (hover: none) {
158+
// Note that we only negate the `:hover` rather than setting it to always be `display: none`,
159+
// in order to maintain the focus indication for hybrid touch + keyboard devices.
160+
.mat-radio-container:hover & {
161+
display: none;
162+
}
163+
}
154164
}
155165

156166
.mat-radio-input {

0 commit comments

Comments
 (0)