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] mod modifier listens to ctrl on macOS #1181

Closed
ItaiYosephi opened this issue May 30, 2024 · 5 comments
Closed

[BUG] mod modifier listens to ctrl on macOS #1181

ItaiYosephi opened this issue May 30, 2024 · 5 comments

Comments

@ItaiYosephi
Copy link

Describe the bug
mod should only listen to meta, but on macOS, it also listens to ctrl.

To Reproduce
Steps to reproduce the behavior:

  1. using macOS, press ctrl+k in the following stackblitz demo

Link to reproducable

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: macOS
  • Browser chrome
@terryttsai
Copy link

+1, I am seeing the same issue

@JohannesKlauss
Copy link
Owner

This is not a bug, but standard behavior and mentioned in the docs. If you want to listen to meta, then you have to listen to meta and not mod. mod will capture both modifier keys. This is the browsers behavior

@terryttsai
Copy link

terryttsai commented Jul 1, 2024

Maybe can update the documentation to make that more clear then?

"mod (which listens for ctrl on Windows/Linux and cmd on macOS)"

could be

"mod (which listens for ctrl on Windows/Linux and either ctrl or cmd on macOS)"

@ItaiYosephi
Copy link
Author

ItaiYosephi commented Jul 1, 2024

@JohannesKlauss as @terryttsai commented, from the docs its seems that mod shuld only correspond to cmd on macOS...
Maybe we can reopen this as a feature request? To add a new modifier that will correspond to ctrl on Windows and cmd on macOS?
Currently there is now way to achieve it, but it seems like a pretty common use case . For example, on macOS , only cmd+k opens a command menu on GitHub/Linear/Jira (ctrl+k opens the menu on Windows but not on macOS).

@terryttsai
Copy link

As a workaround, I'm using react-device-detect and setting meta for macOS and ctrl for Windows:

import { isMacOs } from 'react-device-detect';

export const MOD_KEY = isMacOs ? 'meta' : 'ctrl';

But it would be nice if we can add a modifier that just corresponds to cmd on macOS and ctrl in Windows/Linux

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

3 participants