Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard support handle issue when multi connect option is used. #230

Open
pavandixit93 opened this issue Mar 3, 2021 · 1 comment
Open

Comments

@pavandixit93
Copy link

pavandixit93 commented Mar 3, 2021

Visit https://refreshless.com/nouislider/slider-options/#section-keyboard-support
Go to Keyboard support example
Focus the first slider thumb(slider handle) or Click on first slider thumb
Now press right arrow key to move first slider towards second slider

Expected Result:
It should move the slider handle and should stop once it reaches to second slider thumb since second slider thumb value is the max value for first slider thumb.

Actual Result:
I use keyboard keys to slide the slider thumb it slides the first slider thumb even after reaching to next slider and after that it slides the both sliders. It works perfectly if I drag slider thumb using mouse.

This is very strange behavior please have a look. this is a production issue.
By the way this works perfectly in https://refreshless.com/nouislider/slider-options/#section-keyboard-support

@pavandixit93
Copy link
Author

pavandixit93 commented Mar 5, 2021

Hi Team,
Since it was production issue, i did further debugging in library code and there i found the glitch.
The issue is in function this.defaultKeyHandler.
In this function it is not checked that the slider value is greater than or equal to the next slider value.

if(this.value[index]>=this.value[index+1] && sign!==-1){
   return;
 }

//this.value[index]>=this.value[index+1] if lower slider value is greater than or equal to upper slider value and user pressed Right Arrow key dont increase value and return from function.
// sign!==-1 this is required so that if i decrease slider value by pressing Left Arrow key it should work.
Here is the fix for that]

If i add above 3 lines of code after switch case defined inside this.defaultKeyHandler function it starts working fine.
I can not add patch inside node_modules, I request you people to make this change and publish the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant