Can't add separate 'keydown' and 'keyup' actions for the same key
See original GitHub issueThe code below should print both DOWN and UP, but only prints UP.
hotkeys.bindTo($scope).add({
combo: 'a', action: 'keydown', callback: function() {
console.log("DOWN");
},
combo: 'a', action: 'keyup', callback: function() {
console.log("UP");
}
});
Issue Analytics
- State:
- Created 8 years ago
- Comments:7
Top Results From Across the Web
Keyboard: keydown and keyup - The Modern JavaScript Tutorial
So if we want to track any input into an <input> field, then keyboard events are not enough. There's another event named input...
Read more >Prevent JavaScript keydown event from being handled ...
In a keyDown function (I have added the document.addEventListener code). Now it works just fine, and does exactly what I want it to...
Read more >Keydown is the only keyboard event we need - Mutually Human
Keyboard events, keydown and keyup , are independent from each other. In fact, they sandwich the browser performing the action that the user...
Read more >Element: keydown event - Web APIs | MDN
The keydown and keyup events provide a code indicating which key is pressed, while keypress indicates which character was entered.
Read more >Detect single and multiple keypress events: JavaScript
More commonly it is likely that we want to tie the 'do something' to a specific key press. This is why it is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It actually works if I add the ‘keyup’ action before I add the ‘keydown’ action.
That, or just pass the action as a second parameter through to the Mousetrap method as I’ve done here. 😃