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

[BUG] Line Breaks in Textarea Disable Hotkeys Until Refocusing

Open jordantomax opened this issue 6 years ago • 2 comments

Describe the bug Adding a line break (i.e. hitting enter in the textarea) appears to deactivate react-hotkeys until re-focused. See https://codesandbox.io/embed/ecstatic-https-04p9f

In that example, the key map combination is meta+up. The handler simply outputs the value of the textarea. If you add some text, then add a few line breaks and add some more text, then immediately try to activate the handler by hitting meta+up, nothing happens. If you unfocus and refocus, things work as expected.

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

Expected behavior Line breaks in the textarea should have no effect hotkeys working.

Platform (please complete the following information):

  • Version of react-hotkeys 2.0.0-pre8
  • Browser [e.g. chrome, safari] Chromium 74.0.3729.108
  • OS: [e.g. iOS] MacOS

Are you willing and able to create a PR request to fix this issue? Depending on the scope of the issue (which you may understand better than I do)

APPLICABLE TO v2.0.0-pre1 AND ABOVE: ======================

Include the smallest log that includes your issue: Happy to do this if code sandbox is not adequate

What Configuration options are you using? None!

jordantomax avatar Jul 01 '19 14:07 jordantomax

Do you find any solution?

andorep avatar Oct 02 '19 01:10 andorep

@andreperegrina I never did! I actually ended up swapping out React Hotkeys for a hooks based approach where this was an issue. It's possible that the newest version does fix the problem though, maybe @greena13 can confirm?

jordantomax avatar Oct 06 '19 22:10 jordantomax