Skip to content

Commit 5b59fd4

Browse files
committed
fix(slide-toggle): don't show hover ripples on touch devices
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.
1 parent efeefd1 commit 5b59fd4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/lib/slide-toggle/slide-toggle.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,14 @@ $mat-slide-toggle-bar-track-width: $mat-slide-toggle-bar-width - $mat-slide-togg
214214
&, .mat-slide-toggle.mat-disabled .mat-slide-toggle-bar:hover & {
215215
opacity: 0;
216216
}
217+
218+
// Hover styles will be displayed after tapping on touch devices.
219+
// Disable the hover styling if the user's device doesn't support hovering.
220+
@media (hover: none) {
221+
.mat-slide-toggle-bar:hover & {
222+
display: none;
223+
}
224+
}
217225
}
218226

219227
/** Custom styling to make the slide-toggle usable in high contrast mode. */

0 commit comments

Comments
 (0)