Skip to content

Conversation

evanwalsh
Copy link

@evanwalsh evanwalsh commented May 27, 2025

This fixes #1070

This lets you see the modifiers within the keys array from the handler:

useHotkeys(['ctrl+alt+z'], (_, {keys}) => {
    console.log(keys) // expected output: ['ctrl', 'alt', 'z']
}, {includeModifiersInKeys: true})

To avoid breaking existing usage, since this would change the output of the keys array, this is not enabled by default.

Please let me know if I can improve anything (especially the name of the option [it's a bit wordy]).

Fixes "[QUESTION] - Keys doesn't include modifiers?" JohannesKlauss#1070
Copy link

vercel bot commented May 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-hotkeys-hook ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 27, 2025 3:15pm

@JohannesKlauss
Copy link
Owner

Sorry for the late response: @evanwalsh I'm unsure about the new option for this. Thinking about it, I would say it's currently a bug and the expected default behaviour should be to include all keys.
I'd vote to get rid of the option and make this behavior the default.

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

Successfully merging this pull request may close these issues.

[QUESTION] - Keys doesn't include modifiers?

2 participants