Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Unable to preventDefault on "meta + enter" sequences, so browser treats enter as click #338

Open
JoeVanGundy opened this issue Mar 14, 2022 · 0 comments

Comments

@JoeVanGundy
Copy link

Describe the bug

  • A user just clicked a menu item.
  • They then use the meta + enter combo to run an unrelated task.
  • Since they used the enter key, the browser treats it as a click event and clicks the menu item, then react-hotkeys run the handler.

I'd like to preventDefault, or something similar, on all browser events if and only if the user used the meta+enter combo.

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

Expected behavior
I'm using the meta + enter combo. A menu item is currently focused. If the user enters the combination, I would expect the enter key shouldn't fire the browser click event on the menu item.

Platform (please complete the following information):

  • Version of react-hotkeys: 2.0.0
  • Browser [e.g. chrome, safari]: chrome
  • OS: [e.g. iOS]: Mac

Include the smallest log that includes your issue:

The meta + enter combo is matched long after the menu item has already been clicked.
image

What Configuration options are you using?
None as I was unable to find anything that could help me here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant