Open danhk0612 opened 3 years ago
@danhk0612
hotkeys('*', function() {
if (hotkeys.shift) {
console.log('shift is pressed!');
}
});
+1 doesn't work for me either @danhk0612 did you find a workaround?
using the asterisk works, but if one just wants to get the shift event then it doesn't work. I'm using the react hooks version and even this:
useHotkeys('⇪,shiftKey,shift', (k)=>{
console.log(k, hotkeys.getPressedKeyCodes());
}, {keydown:true, keyup:true})
doesn't work. I've tried each on their own too, but only if I use the *
does it work.
same thing, using the keyup
doesn't work either
我按了一下shift键,这是结果
@Tamcony, I don't think this is correct...
Because on the keydown
event the event.shiftKey
can be true
even if you press any shift+*
combination. Moreover, on the keyup
if the Shift
key is lifted, the event.shiftKey
won't be true
. Instead, you should check for the hotkeys.shift && evt.key === 'Shift'
hotkeys("shift", { keyup: true }, function (evn, handler) { // eventFunction... }
if i press shift key, doesnt execute event function.