Skip to content

bug(mat-slider): on Firefox, slider thumb is not aligned with cursor #34094

Open

Description

@HMPerson1

Is this a regression?

  • 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.

Reproduction

https://material.angular.dev/components/slider/overview

Expected Behavior

The thumb stays aligned with the cursor.

Actual Behavior

The thumb is closer to the center of the track than the cursor is.

chrome_iyUSmg4CxN.mp4

Environment

  • Angular: 22.2.4
  • CDK/Material: 22.2.6
  • Browser(s): Firefox 159.0.1
  • Operating System: Windows

Activity

  1. added
    needs triage
    on Nov 7, 2026
  2. Devyalamaddi commented on Nov 7, 2026

    @Devyalamaddi

    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:

    1. 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.

    2. 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.

    3. 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.

  3. added
    P4
    and removed
    needs triage
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4area: material/slider

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions