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

[BUG] key mapping with `alt+...` doesn't work because `alt` changes keyboard keys

Open ChristoRibeiro opened this issue 5 years ago • 6 comments

Describe the bug I'm trying to add the shortcut alt+h but the real shortcut is actually alt+Ì. If I press alt then the key h become Ì. So I need to register alt+Ì to handle alt+h. I'm not sure if it's a bug or normal behavior.

How are you using react hotkeys components? (HotKeys, GlobalHotKeys, IgnoreKeys, etc) GlobalHotKeys

Expected behavior Add the key map alt+h.

Platform:

  • react-hotkeys: 2.0.0
  • Browser: Chrome 80.0.3987.87
  • OS: macOS 10.15.3
  • Keyboard: AZERTY

Are you willing and able to create a PR request to fix this issue? No unfortunately

Include the smallest log that includes your issue:

HotKeys (GLOBAL-E1💚): New 'Alt' keydown event (that has NOT passed through React app).
inject.js:38244 HotKeys (GLOBAL-E1💚-C0🔺): No matching actions found for 'Alt' keydown.
inject.js:40393 HotKeys (GLOBAL-E2💙): New (simulated) 'Alt' keypress event (that has NOT passed through React app).
inject.js:40630 HotKeys (GLOBAL-E2💙): Ignored 'Alt' keypress because it doesn't have any keypress handlers.
inject.js:40393 HotKeys (GLOBAL-E3💛): New 'Ì' keydown event (that has NOT passed through React app).
inject.js:38244 HotKeys (GLOBAL-E3💛-C0🔺): No matching actions found for 'Alt+Ì' keydown.
inject.js:40393 HotKeys (GLOBAL-E4💜): New 'Ì' keypress event (that has NOT passed through React app).
inject.js:40630 HotKeys (GLOBAL-E4💜): Ignored 'Alt+Ì' keypress because it doesn't have any keypress handlers.
inject.js:40393 HotKeys (GLOBAL-E5🧡): New 'Ì' keyup event (that has NOT passed through React app).
inject.js:40630 HotKeys (GLOBAL-E5🧡): Ignored 'Alt+Ì' keyup because it doesn't have any keyup handlers.
inject.js:40393 HotKeys (GLOBAL-E6❤️): New 'Alt' keyup event (that has NOT passed through React app).
inject.js:40630 HotKeys (GLOBAL-E6❤️): Ignored 'Alt+Ì' keyup because it doesn't have any keyup handlers.
inject.js:40949 HotKeys: Window focused - clearing key history

What Configuration options are you using? No option.

ChristoRibeiro avatar Feb 11 '20 11:02 ChristoRibeiro

It works for me w.r.t. triggering the shortcut, but it also pastes in the special character as well =\

Stvad avatar Mar 01 '20 06:03 Stvad

I was able to repro this issue on Mac in Chrome on react-hotkeys 2.0.0.

ilias-t avatar Apr 10 '20 23:04 ilias-t

relates to #248, #215, & #232

ilias-t avatar Apr 10 '20 23:04 ilias-t

https://github.com/greena13/react-hotkeys/issues/232#issuecomment-544253167

I'm afraid my advice in the short term is to avoid any key combinations with alt in them.

ilias-t avatar Apr 10 '20 23:04 ilias-t

@ChristoRibeiro why was this issue closed?

ilias-t avatar May 27 '20 23:05 ilias-t

Oops wrong issue closed. Sorry!

ChristoRibeiro avatar May 28 '20 05:05 ChristoRibeiro