Skip to content

Commit

Permalink
fix(checkbox): don't show hover ripples on touch devices (#13700)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
crisbeto authored and jelbourn committed May 13, 2019
1 parent f6cd86e commit 43b4fec
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/material/checkbox/checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,16 @@ $_mat-checkbox-mark-stroke-size: 2 / 15 * $mat-checkbox-size !default;
&, .mat-checkbox.mat-disabled .mat-checkbox-inner-container:hover & {
opacity: 0;
}

// Hover styles will be displayed after tapping on touch devices.
// Disable the hover styling if the user's device doesn't support hovering.
@media (hover: none) {
// Note that we only negate the `:hover` rather than setting it to always be `display: none`,
// in order to maintain the focus indication for hybrid touch + keyboard devices.
.mat-checkbox-inner-container:hover & {
display: none;
}
}
}

.mat-checkbox-checkmark {
Expand Down

0 comments on commit 43b4fec

Please sign in to comment.