jaywcjlove / hotkeys-js

➷ A robust Javascript library for capturing keyboard input. It has no dependencies.
https://jaywcjlove.github.io/hotkeys-js
MIT License
6.65k stars 410 forks source link

hotkey.ctrl is not detecting pressed ctrl key correctly #476

Open semrola opened 8 months ago

semrola commented 8 months ago

For example we have this snippet of code:

hotkeys('ctrl+i', function(event) {
    event.preventDefault();
    alert('This is ctrl+i');
})

hotkeys('shift+k', function(event) {
    event.preventDefault();
    let ctrl = hotkeys.ctrl;
    alert('Is ctrl pressed: ' +  ctrl);
})

If we execute ctrl+i first and then shift+k, the second alert will indicate that ctrl is pressed even though it is not. Tested with version 3.13.7.

semrola commented 7 months ago

Found out that hotkeys.isPressed('ctrl') is working correctly.