so the thing is that 'keydown' event calls after the keyup event if multiple keys are pressed and released in particular order in chrome, but seems like there is no such issue in firefox browser
for example we have these events on window with if (e.repeat) return
to prevent repeat
window.addEventListener('keydown', (e) => {
if (e.repeat) return
console.log(e.key, 'pressed')
})
window.addEventListener('keyup', (e) => {
console.log(e.key, 'released')
})
and here is the result of me pressing multiple keys at once and then releasing them one by one
any ideas of how to fix this? i think it has something to do with if (e.repeat) return
and there is a better way to prevent this event repeat on button hold
Caused by Chromium bug, has been open for 5 years: https://bugs.chromium.org/p/chromium/issues/detail?id=843558
See also: Pressing 2 keys, release 1, produces keydown of other key again