Skip to content

Commit 43b4fec

Browse files
crisbetojelbourn
authored andcommitted
fix(checkbox): don't show hover ripples on touch devices (#13700)
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. Fixes #13675.
1 parent f6cd86e commit 43b4fec

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/material/checkbox/checkbox.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,16 @@ $_mat-checkbox-mark-stroke-size: 2 / 15 * $mat-checkbox-size !default;
296296
&, .mat-checkbox.mat-disabled .mat-checkbox-inner-container:hover & {
297297
opacity: 0;
298298
}
299+
300+
// Hover styles will be displayed after tapping on touch devices.
301+
// Disable the hover styling if the user's device doesn't support hovering.
302+
@media (hover: none) {
303+
// Note that we only negate the `:hover` rather than setting it to always be `display: none`,
304+
// in order to maintain the focus indication for hybrid touch + keyboard devices.
305+
.mat-checkbox-inner-container:hover & {
306+
display: none;
307+
}
308+
}
299309
}
300310

301311
.mat-checkbox-checkmark {

0 commit comments

Comments
 (0)