react-hotkeys-hook icon indicating copy to clipboard operation
react-hotkeys-hook copied to clipboard

[BUG] Does not handle the 'Alt Graph' modifier key

Open moloko opened this issue 2 years ago • 1 comments

If I create a simple, single-key shortcut, like this:

useHotkeys("c", (e) => console.log('shortcut activated'));

I would expect it not to activate when the Alt Gr modifier key is held down, as per other modifer keys such as , , , Ctrl etc. - but it does.

I've set up a demo of this here, although obviously you'll need to access this from Windows to be able to replicate!

I have checked this in Windows 10 using Chrome and Edge.

It looks to me like the best method for detecting the use of this modifier key is via event.getModifierState('AltGraph').

I'm happy to have a go a fixing this if you want, just let me know.

moloko avatar Feb 20 '24 12:02 moloko

If you have time, please add a PR for that 🙂

JohannesKlauss avatar Apr 22 '24 13:04 JohannesKlauss