Skip to content

Commit cc8f871

Browse files
crisbetojelbourn
authored andcommitted
fix(slider,slide-toggle): use the grab cursor (#3821)
Uses the `grab` cursor when hovering over an active slider's thumb and thumb labels, as well as on active slide toggles. Fixes #3778.
1 parent 9490c90 commit cc8f871

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

src/lib/core/style/_vendor-prefixes.scss

+5
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,9 @@
2828
cursor: -webkit-grab;
2929
cursor: grab;
3030
}
31+
32+
@mixin cursor-grabbing {
33+
cursor: -webkit-grabbing;
34+
cursor: grabbing;
35+
}
3136
/* stylelint-enable */

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ $mat-slide-toggle-bar-track-width: $mat-slide-toggle-bar-width - $mat-slide-togg
103103

104104
// Once the thumb container is being dragged around, we remove the transition duration to
105105
// make the drag feeling fast and not delayed.
106-
&.mat-dragging {
106+
&.mat-dragging, &:active {
107+
@include cursor-grabbing;
108+
107109
transition-duration: 0ms;
108110
}
109111
}

src/lib/slider/slider.scss

+16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@import '../core/style/variables';
2+
@import '../core/style/vendor-prefixes';
23

34

45
// This refers to the thickness of the slider. On a horizontal slider this is the height, on a
@@ -97,7 +98,20 @@ $mat-slider-focus-ring-size: 30px !default;
9798
}
9899
}
99100

101+
%_mat-slider-cursor {
102+
.mat-slider:not(.mat-slider-disabled) & {
103+
@include cursor-grab;
104+
}
105+
106+
.mat-slider:not(.mat-slider-disabled) &:active,
107+
.mat-slider-sliding:not(.mat-slider-disabled) & {
108+
@include cursor-grabbing;
109+
}
110+
}
111+
100112
.mat-slider-thumb {
113+
@extend %_mat-slider-cursor;
114+
101115
position: absolute;
102116
right: -$mat-slider-thumb-size / 2;
103117
bottom: -$mat-slider-thumb-size / 2;
@@ -113,6 +127,8 @@ $mat-slider-focus-ring-size: 30px !default;
113127
}
114128

115129
.mat-slider-thumb-label {
130+
@extend %_mat-slider-cursor;
131+
116132
display: none;
117133
align-items: center;
118134
justify-content: center;

0 commit comments

Comments
 (0)