hotkeys-js
hotkeys-js copied to clipboard
isPressed is true on keyup
The event keyup
is fired when a key is released (aka not pressed), so why is hotkeys.isPressed(key)
still returning true for that key that fired that event?
@rakusan2 Are there any examples for me to test?
Here is a simplified example
hotkeys('1', { keyup: true }, function(event, handler) {
if (event.repeat) return
const key = hotkeys.isPressed('1')
console.log({ type: event.type, key })
})
Result
{type: "keydown", key: true}
{type: "keyup", key: true}
What I expect
{type: "keydown", key: true}
{type: "keyup", key: false}