Skip to content

fix(defineShortcuts): defer standalone shortcuts that prefix a chain#266

Merged
IgorShevchik merged 1 commit into
mainfrom
sync/nuxt-76ee176
Jul 10, 2026
Merged

fix(defineShortcuts): defer standalone shortcuts that prefix a chain#266
IgorShevchik merged 1 commit into
mainfrom
sync/nuxt-76ee176

Conversation

@IgorShevchik

Copy link
Copy Markdown
Collaborator

Syncs upstream nuxt/ui commit 76ee176fix(defineShortcuts): defer standalone shortcuts that prefix a chain (#5654).

What

When a standalone shortcut (f) is also the first key of a chained shortcut (f-h), pressing f used to fire the standalone immediately and swallow the chain. The fix holds the standalone back (pendingShortcut + pendingTimer via useTimeoutFn) until one of:

  • the chain completes → cancel the pending standalone, fire the chain;
  • the chain delay elapses → fire the standalone;
  • a non-completing key arrives → fire the standalone, then the new key.

The held shortcut is re-resolved just before firing, so a state change in the meantime (e.g. focus moved into an input, disabling it) is honored. Also adds cached chainedShortcuts / standardShortcuts / chainPrefixes computeds so each keydown doesn't re-filter the shortcut list.

b24ui's composable matched upstream exactly, so the runtime hunks applied verbatim.

Deviation — test matcher

b24ui's vitest setup registers only vitest-axe/matchers (no jest-extended), so toHaveBeenCalledBefore isn't available. The single call-order assertion was rewritten as expect(f.mock.invocationCallOrder[0]).toBeLessThan(x.mock.invocationCallOrder[0]). Everything else (the 5 new regression tests + the document.body.innerHTML = '' teardown) is verbatim.

Verify (CI=true)

dev:prepare · lint · typecheck · test · build — all green. Suite 5477 passed / 6 skipped (+10 across the two projects). No snapshot changes.

Ledger: cursor advanced to 76ee176; previous entry 71c623b reconciled to PR #265.

🤖 Generated with Claude Code


Generated by Claude Code

…(76ee176)

A standalone shortcut that is also the first key of a chained shortcut
(f and f-h) is now held back until the chain completes, the chain delay
elapses, or a non-completing key arrives - so pressing f no longer fires
the standalone and swallows the chain. The held shortcut is re-resolved
before firing so a state change (e.g. focus into an input) is honored.
Adds cached chained/standard/prefix computeds and the upstream tests.

The one call-order assertion is rewritten via mock.invocationCallOrder,
since b24ui's test setup does not register jest-extended matchers.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JS8ypVfQSFzYVZzkTHhURb
@IgorShevchik IgorShevchik merged commit f79adba into main Jul 10, 2026
1 check passed
@IgorShevchik IgorShevchik deleted the sync/nuxt-76ee176 branch July 10, 2026 17:21
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.

2 participants