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
[slider] Arrow keys jump to the wrong mark when the value is between two marks with step={null} #49893
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).
Activity