react-input-range icon indicating copy to clipboard operation
react-input-range copied to clipboard

Using the keyboard exceed the max or min values

Open zoharbob opened this issue 6 years ago • 5 comments

When I tried to control the keyboard to change the values of "Range" component, I could exceed the max and min values.

zoharbob avatar Aug 05 '18 13:08 zoharbob

I couldn't produce the same issue. It was fixed in some later version?

obouchari avatar Oct 18 '18 12:10 obouchari

No, this issue it still open. Just tried to take the example from "usage" to accept min/max value, In case using the keyboard only, when reaching the max/min value and keep clicking on the arrow key, the value still getting higher/lower although the limit of the max/min props.

zoharbob avatar Oct 19 '18 19:10 zoharbob

Can you provide the code that produced the issue?

obouchari avatar Oct 20 '18 00:10 obouchari

Happens on multi value slider, due to missing parens following allowSameValue PR. We are sending a PR with @Lacourvincent to fix this and another bug on slider mouse dragging

Mattgic avatar Nov 07 '18 10:11 Mattgic

I think, i have same issue. But i can reproduce this, only when using redux-form. https://codesandbox.io/s/14z7mr2mw3

Fix in my project:

  const params = {
    minValue: 9,
    maxValue: 18,
    step: 0.5,
    onChange: value => {
      const min = value.min < params.minValue ? params.minValue : value.min
      const max = value.max > params.maxValue ? params.maxValue : value.max
      const isIntervalTimeOk = max - min >= 3

      return isIntervalTimeOk && onChange({ min, max }) // onChange of redux input field
    }
  }

<InputRange draggableTrack { ...params } />

Nick-bcm avatar Feb 04 '19 23:02 Nick-bcm