Skip to content

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

@stwilz

Description

@stwilz

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Version 5.xThese tickets will be solved in Version 5.xenhancementNew feature or requestgood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions