Closed ItaiYosephi closed 1 week ago
+1, I am seeing the same issue
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
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)"
@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).
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
Describe the bug
mod
should only listen tometa
, but on macOS, it also listens toctrl
.To Reproduce Steps to reproduce the behavior:
ctrl+k
in the following stackblitz demoLink 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):