leongersen / noUiSlider

noUiSlider is a lightweight, ARIA-accessible JavaScript range slider with multi-touch and keyboard support. It is fully GPU animated: no reflows, so it is fast; even on older devices. It also fits wonderfully in responsive designs and has no dependencies.
https://refreshless.com/nouislider/
MIT License
5.66k stars 659 forks source link

updateOptions({start: 0}) does not move slider position #1127

Closed JonathanGawrych closed 3 years ago

JonathanGawrych commented 3 years ago

When you pass start: 0 to updateOptions, it does not move the slider, but instead uses the current position. Here's an example of that: https://plnkr.co/edit/JuHqtg7EMQX7QejI

It looks like the issue is https://github.com/leongersen/noUiSlider/blob/14.6.3/src/nouislider.js#L2601. The code assumes a falsey start value should use the current value, but 0 is a valid start value. Instead it should only be a undefined (or null) value that uses the current value.

(obviously set is the correct function for updating values, but this is a specific case where I need to update various options and restart the slider back to 0)

leongersen commented 3 years ago

I'd say you are quite right, looks like a bug.

leongersen commented 3 years ago

Fixed in noUiSlider 14.6.4. Thanks for reporting!

JonathanGawrych commented 3 years ago

Awesome. Thanks for the amazing (accessible) library!

github-actions[bot] commented 2 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.