question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`update` event fires for all handles when one is changed with a key press

See original GitHub issue

With multiple handles, moving one of them using the keyboard causes an update event to fire on all 3 handles.

noUiSlider.create(slider_el, {
    start: [30, 60, 90],
    behaviour: 'drag',
    connect: true,
    tooltips: [true, true, true],
    range: {
	'min': 0,
	'max': 100
    }
});
slider_el.noUiSlider.on('update', 
    function(v, h, u, t, p) { if (!t) { console.log('update:', h); }});
slider_el.noUiSlider.on('set', 
    function(v, h, u, t, p) { if (!t) { console.log('set:', h); }}

Expected output upon moving handle number 2 with keyboard:

update: 1
set: 1

Actual output:

update: 0
update: 1
set: 1
update: 2

This causes a bug with my solution in #957 when trying to move handle number 2 back past the margin of handle number 1; the event handler for handle number 1 gets executed first and modifies the position of handle number 2 such that when the update event for handle number 2 subsequently fires, there’s nothing to do.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
leongersencommented, Mar 15, 2019

This is fixed in noUiSlider 13.1.3. Many thanks for contributing, @eoghanmurray! Much appreciated.

0reactions
github-actions[bot]commented, May 28, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 2 change event on every keypress - Stack Overflow
registers an event on every keystroke unlike (change) event; includes the keys that (keypress) ignores; has no lag unlike the (keydown) ...
Read more >
Handling Events :: Eloquent JavaScript
Pressing a key fires "keydown" and "keyup" events. Pressing a mouse button fires "mousedown" , "mouseup" , and "click" events.
Read more >
JavaScript Keyboard Events Explained
The keyboard events typically fire on the text box, though all elements ... Both keydown and keypress events are fired before any change...
Read more >
Element: keydown event - Web APIs | MDN
The keydown event is fired when a key is pressed. Unlike the deprecated keypress event, the keydown event is fired for all keys, ......
Read more >
Detect single and multiple keypress events: JavaScript
At the moment our 'do something' code will fire on every key press. More commonly it is likely that we want to tie...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found