You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(mat-slider): on Firefox, slider thumb is not aligned with cursor #34094
Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
On Firefox, when clicking and dragging on a slider, the slider thumb is not aligned with the cursor. This is most visible near the ends of the slider track.
Hi @HMPerson1, thanks for reporting this and providing the video reproduction!
This happens due to differences in how Gecko (Firefox) and Blink/WebKit calculate the drag position and valueAsNumber on native <input type="range"> elements:
Native thumb & track metrics in Gecko:
Unlike WebKit, Firefox's default range input styles account for native OS thumb dimensions (::-moz-range-thumb, typically ~16px wide) and internal track bounds (::-moz-range-track). The native thumb's travel distance is constrained by width - thumb_width.
Padding and box-sizing: MatSliderInput dynamically sets padding: 0 ${inputPadding}px and box-sizing: content-box on the input element (_updateWidthInactive()). Chromium calculates drag positions across the entire element width, whereas Firefox factors in the internal thumb margins and padding differently when determining valueAsNumber during dragging.
Visual thumb sync:
During active dragging, _onInput() updates the visual thumb position based on this.value (valueAsNumber). Because Firefox's native range calculation has these thumb insets, the computed value near the extremities is skewed toward the center compared to the cursor position.
Resetting the native range appearance on .mdc-slider__input for Gecko (e.g. applying appearance: none;, resetting default margins/borders on ::-moz-range-thumb and ::-moz-range-track, and adjusting the effective track boundaries) should align the drag behavior with Chromium.
Activity
Devyalamaddi commentedon Nov 7, 2026
Hi @HMPerson1, thanks for reporting this and providing the video reproduction!
This happens due to differences in how Gecko (Firefox) and Blink/WebKit calculate the drag position and
valueAsNumberon native<input type="range">elements:Native thumb & track metrics in Gecko:
Unlike WebKit, Firefox's default range input styles account for native OS thumb dimensions (
::-moz-range-thumb, typically ~16px wide) and internal track bounds (::-moz-range-track). The native thumb's travel distance is constrained bywidth - thumb_width.Padding and
box-sizing:MatSliderInputdynamically setspadding: 0 ${inputPadding}pxandbox-sizing: content-boxon the input element (_updateWidthInactive()). Chromium calculates drag positions across the entire element width, whereas Firefox factors in the internal thumb margins and padding differently when determiningvalueAsNumberduring dragging.Visual thumb sync:
During active dragging,
_onInput()updates the visual thumb position based onthis.value(valueAsNumber). Because Firefox's native range calculation has these thumb insets, the computed value near the extremities is skewed toward the center compared to the cursor position.Resetting the native range appearance on
.mdc-slider__inputfor Gecko (e.g. applyingappearance: none;, resetting default margins/borders on::-moz-range-thumband::-moz-range-track, and adjusting the effective track boundaries) should align the drag behavior with Chromium.