Skip to content

[slider] Arrow keys jump to the wrong mark when the value is between two marks with step={null} #49893

Backlog

Description

@PANJA-ABHISHEK

Steps to reproduce

<Slider
  step={null}
  marks={[{ value: 10 }, { value: 20 }, { value: 30 }, { value: 40 }]}
  defaultValue={25}
/>
  1. Focus the thumb.
  2. Press ArrowRight (or ArrowUp).
  3. In a new render, press ArrowLeft (or ArrowDown).

Current behavior

  • ArrowRight moves the value down to the first mark, 10.
  • ArrowLeft does nothing, the value stays at 25.
  • A value change reported through the hidden range input (for example 26) also jumps to 10.

Expected behavior

The value moves to the adjacent mark in the pressed direction: ArrowRight to 30, ArrowLeft to 20.

Context

With step={null} the value is normally one of the marks, but it can be between two marks when it comes from defaultValue / value (for example data saved before the marks changed).

The keyboard handler and changeValue in useSlider.ts look the value up with marksValues.indexOf(value) and then use index - 1 / index + 1. For a value that isn't a mark the index is -1, so "next" becomes marksValues[0] and "previous" becomes marksValues[-2] (undefined).

Your environment

@mui/material on master (a4f20c2).

Search keywords: slider step null marks keyboard

Search keywords:

Activity

  1. added
    status: waiting for maintainer
    on Nov 24, 2026
  2. added
    scope: slider
    on Nov 25, 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

    scope: sliderstatus: waiting for maintainer

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions