Skip to content

Slider step not respected on certain edge cases #734

Open
@ale-rinaldi

Description

@ale-rinaldi

🐛 Bug report

Current Behavior

On certain slider edge cases, for example on a slider with lower limit at 97.25 and higher limit at 102.25 with a step of 0.1, the step is not always respected correctly (for example, I go to 100 to 100.2 instead of 100.1, but I correctly go from 100.2 to 100.3) and it is impossible to move the slider with keyboard arrows.

The slider limits intentionally don't match the range: except those edge cases, I can correctly move up and down with a step of 0.1, but when I am at 100.2 the next step is 100.25 which is the maximum, as I would expect.

Expected behavior

The step is respected correctly in all the situations.

Reproducible example

Sample of the issue on CodeSandbox

Your environment

Software Name(s) Version
Reach Package @reach/slider 0.13.0 (but happens also in previous versions, I tested down to 0.10.5)
React react 17.0.1
Browser Google Chrome 88.0.4324.96
Assistive tech None None
Node node v14.15.1
npm/yarn yarn 1.22.10
Operating System macOS 11.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Help WantedExtra attention is neededType: BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions