-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
useHotkeys doesn't detect plus key #7123
Comments
Fixed with adding this syntax: |
Thank you! |
Am wondering a few things about this one:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dependencies check up
What version of @mantine/* packages do you have in package.json?
7.14.0
What package has an issue?
@mantine/hooks
What framework do you use?
Next.js
In which browsers you can reproduce the issue?
Chrome
Describe the bug
useHotkeys
from@mantine/hooks
doesn't appear to allow binding actions to the+
key. Other arithmetical operations (/
,*
,-
) work as expected. In other words, with:...
handle
gets triggered with any of the/
,*
or-
keys, but not+
.The use-hotkeys documentation links to Key values for keyboard events at MDN, which in turn suggests that the string
Add
might once have worked, but works no longer in modern browsers. I've also verified that the stringsAdd
,Multply
etc. don't work on Chrome 130.0.6723.116.If possible, include a link to a codesandbox with a minimal reproduction
https://codesandbox.io/p/sandbox/mantine-react-template-forked-zrxnsn
Possible fix
parseHotkey
supports strings likealt+j
to specify modifiers. It starts with:which splits the modifier string up into its individual parts. It goes on to check for modifier names such as
alt
,shift
etc. This unfortunately removes any instances of '+' in the hotkey string. Any fix will presumably involve improving this parsing logic to support+
,alt++
etc.Self-service
The text was updated successfully, but these errors were encountered: