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