Skip to content

Commit 5386958

Browse files
committed
fix(material/slider): incorrect indicator transform origin in M3
Fixes that the slider's value indicator was transitioning in from the right in M3. It's because the indicator is rotated in order to render out the M3 shape. Fixes #31827.
1 parent 931ac3c commit 5386958

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/material/slider/_m2-slider.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
slider-with-tick-marks-container-shape: 50%,
2929
slider-with-tick-marks-container-size: 2px,
3030
slider-with-tick-marks-inactive-container-opacity: 0.6,
31+
slider-value-indicator-transform-origin: bottom,
3132
),
3233
color: map.merge(private-get-color-palette-color-tokens($theme, primary), (
3334
slider-disabled-active-track-color: map.get($system, on-surface),

src/material/slider/_m3-slider.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
/// @param {String} $color-variant The color variant to use for the component
88
@function get-tokens($theme: m3.$sys-theme, $color-variant: null) {
99
$system: m3-utils.get-system($theme);
10+
$indicator-size: 28px;
11+
1012
@if $color-variant {
1113
$system: m3-utils.replace-colors-with-variant($system, primary, $color-variant);
1214
}
@@ -15,8 +17,8 @@
1517
base: (
1618
slider-value-indicator-opacity: 1,
1719
slider-value-indicator-padding: 0,
18-
slider-value-indicator-width: 28px,
19-
slider-value-indicator-height: 28px,
20+
slider-value-indicator-width: $indicator-size,
21+
slider-value-indicator-height: $indicator-size,
2022
slider-value-indicator-caret-display: none,
2123
slider-value-indicator-border-radius: 50% 50% 50% 0,
2224
slider-value-indicator-text-transform: rotate(45deg),
@@ -29,6 +31,7 @@
2931
slider-with-tick-marks-active-container-opacity: 0.38,
3032
slider-with-tick-marks-container-size: 2px,
3133
slider-with-tick-marks-inactive-container-opacity: 0.38,
34+
slider-value-indicator-transform-origin: 0 $indicator-size,
3235
),
3336
color: (
3437
slider-active-track-color: map.get($system, primary),

src/material/slider/slider.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ $fallbacks: m3-slider.get-tokens();
104104
display: flex;
105105
align-items: center;
106106
transform: scale(0);
107-
transform-origin: bottom;
107+
transform-origin: token-utils.slot(slider-value-indicator-transform-origin, $fallbacks);
108108
transition: transform 100ms cubic-bezier(0.4, 0, 1, 1);
109109

110110
// Stop parent word-break from altering

0 commit comments

Comments
 (0)