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

[QUESTION] - Keys doesn't include modifiers? #1070

Open
stwilz opened this issue Aug 23, 2023 · 1 comment
Open

[QUESTION] - Keys doesn't include modifiers? #1070

stwilz opened this issue Aug 23, 2023 · 1 comment
Labels
enhancement New feature or request Version 5.x These tickets will be solved in Version 5.x

Comments

@stwilz
Copy link

stwilz commented Aug 23, 2023

Hi! Just migrated from v3 to v4 and noticed that our returned keys doesn't include modifiers?

Previously we did these ones.

  const HOTKEYS = [
    {
      keys: 'ctrl+alt+s',
      type: 'save',
    },
    {
      keys: 'ctrl+alt+f',
      type: 'find',
    },
  ]

  useHotkeys(
    HOTKEYS.map(hotkey => hotkey.keys).join(','),
    (_, { key }) =>
      setActive(HOTKEYS.find(({ keys }) => keys === key)?.type || null)
  )

Which was pretty straight forward but now we've needed to put in some extra smarts to match the callbacks. Is not including the modifiers the expected behavior?

PS Great work on the library!

@JohannesKlauss
Copy link
Owner

Ah yes, this is a design issue that will be fixed in version 5. Thank you for reporting this

@JohannesKlauss JohannesKlauss added enhancement New feature or request Version 5.x These tickets will be solved in Version 5.x labels Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Version 5.x These tickets will be solved in Version 5.x
Projects
None yet
Development

No branches or pull requests

2 participants