Skip to content

Commit 48d17af

Browse files
devversionjelbourn
authored andcommitted
fix(slide-toggle): thumb animation not working on mobile (#15236)
With cc8f871, we enabled the `grabbing` cursor if the thumb container is pressed. This accidentally broke animation for the thumb sometimes because the `:active` pseudo class is added on tap/touch and now accidentally sets the thumb transition duration to `0ms`. Rather we should only set the thumb transition duration to `0ms` if the user started dragging the thumb (with a small threshold) Fixes #15232
1 parent 0673574 commit 48d17af

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,14 @@ $mat-slide-toggle-bar-track-width: $mat-slide-toggle-bar-width - $mat-slide-togg
113113

114114
// Once the thumb container is being dragged around, we remove the transition duration to
115115
// make the drag feeling fast and not delayed.
116-
&.mat-dragging, &:active {
117-
@include cursor-grabbing;
116+
&.mat-dragging {
118117
transition-duration: 0ms;
119118
}
120119

120+
&:active {
121+
@include cursor-grabbing;
122+
}
123+
121124
._mat-animation-noopable & {
122125
transition: none;
123126
}

0 commit comments

Comments
 (0)