Skip to content

fix(hotkey): resilient sequence parsing#22704

Merged
KaelWD merged 4 commits intomasterfrom
kaelwd/proper-hotkey-parser
Mar 12, 2026
Merged

fix(hotkey): resilient sequence parsing#22704
KaelWD merged 4 commits intomasterfrom
kaelwd/proper-hotkey-parser

Conversation

@KaelWD
Copy link
Copy Markdown
Member

@KaelWD KaelWD commented Mar 11, 2026

Replaces whatever was going on before with a proper recursive parser.
+-/_ literals are now valid.
useHotkey and VHotkey now treat separators the same.
VHotkey displays / as "or" instead of "/".

fixes #22399

Incorrect or inconsistent documentation:

Use +, _, or / for keys pressed together in a combination.

/ was added as "or" in VHotkey (2369274) but not handled correctly in useHotkey. The example up/down doesn't make much sense for a combination.

Spaces are ignored: ctrl + s equals ctrl+s

This was never actually done by either VHotkey or useHotkey as far as I can tell. It was trivial to add to the parser but VHotkey still uses spaces to separate sequences so one of these will have to change for consistency. Has been removed. There is explicit support for space literals ( or ctrl+ ) but ctrl + s is an error.

Not fixed:

  • useHotkey combos with multiple non-modifier keys like a+b, only the last one is used.
  • useHotkey with keys that need a modifier to type
    • + is shift+= on ANSI-US keyboards
    • / is shift+7 on ISO-DE
  • useHotkey with unshifted keys in a combo
    • shift+= on ANSI-US - e.key is + so only shift++ will work

Markup:

<template>
  <v-text-field v-model="keys" />
  <v-hotkey :keys />
  <pre>log: {{ log }}</pre>
</template>
<script setup>
  import { shallowRef } from 'vue'
  import { useHotkey } from 'vuetify'

  const keys = shallowRef('')
  const log = shallowRef('')

  function onHotkey () {
    log.value += '\n- Hotkey pressed'
  }

  useHotkey(keys, onHotkey, {
    sequenceTimeout: 2000,
  })
</script>

@J-Sek J-Sek added T: bug Functionality that does not work as intended/expected E: hotkey C: VHotkey labels Mar 12, 2026
@KaelWD KaelWD added this to the v4.0.x milestone Mar 12, 2026
@KaelWD KaelWD merged commit cae1cea into master Mar 12, 2026
16 checks passed
@KaelWD KaelWD deleted the kaelwd/proper-hotkey-parser branch March 12, 2026 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C: VHotkey E: hotkey T: bug Functionality that does not work as intended/expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report][3.11.2] Hotkeys with + and -

2 participants