Skip to content

Commit

Permalink
fix(radio): don't show hover ripples on touch devices (#13701)
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.

Related to #13675.
  • Loading branch information
crisbeto authored and mmalerba committed Oct 26, 2018
1 parent 13395c5 commit b89c139
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/radio/radio.scss
Expand Up @@ -151,6 +151,16 @@ $mat-radio-ripple-radius: 20px;
&, .mat-radio-disabled .mat-radio-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-radio-container:hover & {
display: none;
}
}
}

.mat-radio-input {
Expand Down

0 comments on commit b89c139

Please sign in to comment.