IonDen / ion.rangeSlider

jQuery only range slider
http://ionden.com/a/plugins/ion.rangeSlider/en.html
MIT License
2.56k stars 508 forks source link

Time range step by arrow keys. #696

Open kirimaks opened 4 years ago

kirimaks commented 4 years ago

If I change slider by arrow keys, sometimes step is doubled.

For example I I have range from 1 to 10 and I drag slider by mouse, everything works well. But if I use arrow keys, I'm getting 1,2,3,5,6 and so on...

This bug is reproduced on "Simple start, basic params" slider on demo page.

IonDen commented 4 years ago

Hi, I think this is happening because by default arrow keys move slider value by ~10% of it scale. This is not optimal.

Potential fix could be if you will use snap_step: true param, and will reassure that step will always round to closest number.

kirimaks commented 4 years ago

@IonDen Thanks. Tried with snap_step: true, unfortunately no change. Here is my full config:

type: "double",   
min: 0, 
max: 100,
from: 20,
to: 30,  
grid: true,                                                                                               
snap_step: true,                                                                                          
step: 1

With this config if I move left handle to zero, then press right arrow, I'm getting: 0, 1, 2, 3, 4, 5, 6, 8, 10 (9 is skipped).

In the same time if to click on handle when it's in 8th position (just click not change value), then move handle by arrow keys it behave normal, 9 is not skipped.

IonDen commented 4 years ago

Yeah, will move it in to bugs then.