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

Odd behaviour with Control/Command key on Mac #21

Closed
silverwind opened this issue Aug 9, 2023 · 4 comments
Closed

Odd behaviour with Control/Command key on Mac #21

silverwind opened this issue Aug 9, 2023 · 4 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@silverwind
Copy link

silverwind commented Aug 9, 2023

Describe the bug

There seems to be some odd behaviour around the Command and Control keys on Mac:

To Reproduce

  1. On Mac, open https://codesandbox.io/s/quizzical-nightingale-c6t37s
  2. Input control+s, it's logged correctly
  3. Input meta+s (Command+s), it's logged correctly
  4. Input control+s, it's logged as meta+s and subsequent presses no longer log at all
{"keyCombo":"control+s"} // ok
{"keyCombo":"meta+s"} // ok
{"keyCombo":"meta+s"} // not what I pressed

Expected behavior
These combos to be detected the same way they are entered.

@RobertWHurst RobertWHurst added the bug Something isn't working label Aug 9, 2023
@RobertWHurst RobertWHurst self-assigned this Aug 9, 2023
@silverwind
Copy link
Author

This snippet of mousetrap may be helpful.

Here is the same demo with mousetrap, it does not exhibit this issue:

https://codesandbox.io/s/bitter-cache-22rssh?file=/src/index.js

@RobertWHurst
Copy link
Owner

I believe the offending file is browser-bindings.ts, likely to do with the special handling of the Command key. I can't debug this until Friday because I'm away from any mac devices, but will have a look as soon as I can. Thanks for filing the issue @silverwind, it's greatly appreciated.

@RobertWHurst RobertWHurst added the help wanted Extra attention is needed label Aug 9, 2023
@RobertWHurst
Copy link
Owner

@silverwind Just published v1.2.1. You should now be able to bind meta/command as you expect, as well as use preventDefault as you expect. Let me know if you run into any more issues. Thanks for raising this issue, it's an important one. 🍻

@silverwind
Copy link
Author

Thanks, I updated the dependency in https://codesandbox.io/s/gracious-fog-xswpdd?file=/src/index.js, and now it's working as expected and both cmd+s and ctrl+s log as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants