ccampbell / mousetrap

Simple library for handling keyboard shortcuts in Javascript
https://craig.is/killing/mice
Apache License 2.0
11.68k stars 969 forks source link

Shortcuts with 2 keys block shortcuts with three #362

Open kvendrik opened 8 years ago

kvendrik commented 8 years ago

Say you have a shortcut for g s and one for g s p. g s p won't work as the library triggers the callback as soon as it gets to g s and then resets. I tested this with the latest version (1.6.0) and tried older versions down to 1.4.2 but the result was the same.

http://codepen.io/anon/pen/rrmyAY?editors=0010

juanparadox commented 7 years ago

I resolved this issue by going the keyCode route with vanilla JS. Would be helpful if someone could update the code to prevent the issue you stated...

kvendrik commented 7 years ago

@juanparadox you might wanna check out https://github.com/shopify/hotshot to use until Mousetrap has implemented a fix.

ntoscomeli commented 4 years ago

@juanparadox could you specify in code how you resolve this issue? Maybe a demo. Thanks in advance

juanparadox commented 4 years ago

@ntoscomeli I basically just captured the keystrokes using key event listeners and debouncing the clicks. Unfortunately, I don't have a demo and apologies for replying so late.