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] Cmd + Shift + 'c' calls the 'c' GlobalHotKey handler #175

Closed
snosenzo opened this issue May 15, 2019 · 3 comments
Closed

[BUG] Cmd + Shift + 'c' calls the 'c' GlobalHotKey handler #175

snosenzo opened this issue May 15, 2019 · 3 comments

Comments

@snosenzo
Copy link

snosenzo commented May 15, 2019

Describe the bug
The key sequence to active element selection in chrome (Cmd + Shift + 'c') is activating our 'c' hotkey handler.
How are you using react hotkeys components? (HotKeys, GlobalHotKeys, IgnoreKeys etc)
Using GlobalHotkeys
Expected behavior
Pressing Cmd + Shift + c should not activate the 'c' function in GlobalHotkeys because modifier keys are being pressed, and should instead just enable Chrome element selection.

Platform (please complete the following information):

  • Version: 2.0.0-pre4
  • Browser: Chrome
  • OS: OSX

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

correct me if this is the expected behavior and there's something that I can do to override/customize this.

@snosenzo snosenzo changed the title [BUG] [BUG] Cmd + Shift + 'c' calls the 'c' GlobalHotKey handler May 15, 2019
@greena13
Copy link
Owner

Hi @snosenzo, thanks for filing your issue.

Unfortunately, this is indeed not surprising (and matches the intended behaviour of the package). If your problem was reversed, and you wanted the hotkey handler to override the browser handler, then I would direct you to the Preventing default browser behaviour section of the Readme.

However, your situation is a little messier and you will have to step outside or react-hotkeys for now ( a feature could be added in the future to declaratively do this). I suggest in your handler, you use the KeyboardEvent's meta property to abort executing whatever your handler does.

I'm closing this for now to help clarify the priority of outstanding issues that need to be addressed, but please let me know if you want to make a feature request to have this added to the library in perhaps a more scalable fashion (the approach above would need to be implemented for each individual handler function).

@greena13
Copy link
Owner

It may interest the reader to know that there is a ongoing similar discussion about when the longer key sequence is another application action, rather than a browser one: #161.

@greena13
Copy link
Owner

greena13 commented Jun 2, 2019

@snosenzo, the fix should be available in v2.0.0-pre7, so when you press cmd+shift+c, it won't trigger the c action.

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

2 participants