Skip to content

chore(deps): move TanStack hotkeys to 0.27 - #1423

Merged
allisonmahmood merged 2 commits into
mainfrom
t3/update-tanstack-hotkeys
Nov 18, 2026
Merged

allisonmahmood merged 2 commits into
mainfrom
t3/update-tanstack-hotkeys

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

What changed

patchy/hotkeys now bundles TanStack Hotkeys 0.27.1 (core) and 0.21.1 (Preact adapter), up from 0.19.0 and 0.17.1. Shortcuts behave for patch authors and viewers as they did. Patches pick it up at their next publish. 0.29.0 / 0.23.0 came out yesterday, so pnpm's 24-hour release-age rule holds them back.

Supersedes #1391, which fails in typecheck rather than at install. preact-hotkeys 0.17.1 still pulls core 0.19.0, so our 0.19.0 patch keeps applying to that copy. Meanwhile the new core lacks the patch's Element target type and its sequence allowStep/onStep options, which hotkeys.ts uses.

Look at

The patch on TanStack, part by part. I read every changelog entry from 0.20 to 0.27.1 and diffed the 0.19.0 and 0.27.1 dist:

What the patch did Now
No match while an input method composes, Enter, Escape and the arrows included. Safari's keydown that commits after compositionend (keyCode 229 only) counts as composing. Dropped: upstream has it since 0.22.0. _match.js refuses any composing key, and normalizeKeyboardEvent counts keyCode 229.
Sequences ask allowStep before taking a key and call onStep as they take one. A sequence on an element takes its keys ahead of chords and sequences further out. Re-created on 0.27.1. Upstream has no equivalent.
A target may be any Element (an SVG chart), not only HTMLElement. Re-created (types only).
— New hunk. Since 0.24.0, every document-level Escape hotkey stands aside while a modal <dialog> or an auto popover is open. That contradicts the hotkeys skill, which says a live Escape hotkey takes the key, and it breaks the skill's "register Escape inside, and close from its run". The browser would close the dialog but leave it mounted, with its HotkeyScope still holding the page's keys. The patch keeps today's behaviour. Adopting upstream's rule is a product decision for another PR, along with the skill text.

The pnpm-workspace.yaml comment says each part and when to drop it.

A test for the Escape hunk, red then green. a native modal dialog's own Escape hotkey takes the key, so its run closes it and the scope goes is new in hotkeys.spec.ts. With upstream's Escape rule put back into the installed copy:

✘  hotkeys.spec.ts:671:1 › a native modal dialog's own Escape hotkey takes the key, so its run closes it and the scope goes
   Error: expect(locator).toHaveCount(expected) failed
   Expected: 0
   Received: 1

With this branch's patch:

✓  hotkeys.spec.ts:671:1 › a native modal dialog's own Escape hotkey takes the key, so its run closes it and the scope goes (662ms)

A test for composition. The browser spec covers Safari's committing Enter only inside a text field, where fieldKeeps holds it back whatever TanStack does. A new unit case in hotkeys.test.ts pins TanStack's own matching for Escape, Enter, ArrowDown, Mod+Enter and K. Each matches plainly, not with isComposing, and not with keyCode 229 alone. Unpatched 0.19.0 fails it: every one of those matches with keyCode 229, and all but K match while composing.

Other upstream changes that reach pages, all matching fixes, none touching our API:

  • A press reported as Unidentified that has a usable code is no longer treated as composing (0.25.0). Chrome on Wayland sends Ctrl+` this way. fieldKeeps still keeps every Unidentified key in text fields. Android's composing keys carry keyCode 229 and are still ignored.
  • Windows: Ctrl+Alt on a letter key that types a Latin letter, such as Polish ą, no longer fires Mod+Alt+<letter> (0.26.0).
  • Turkish ı is its own key, and Firefox numpad 5 without NumLock no longer fires 5 (0.27.0).
  • TanStack Store is gone from the bundle (0.20.0): the stores are TanStack Hotkeys' own. The release's dist/licenses now carries one TanStack notice, and ADR-0011 says so.

Formatting with formatHotkey/hotkeyKeys is byte-identical between versions for every form we use, modifiers alone included, on Mac and elsewhere.

How it was verified

  • pnpm verify (mise's Node 24 first on PATH): format, lint, typecheck, synth, postgres-concurrency, cli-smoke, install and tier2-smoke pass. The rest failed on the shared machine while sibling worktrees ran their own suites, at a load average of 25 to 50. test and test (bun) failed with timeouts only. browser failed when a throwaway instance couldn't bind its port, which stopped the run. Rerun at a load of about 6: test:bun passes, and test passes but for two 5-second timeouts in company-database and patches. The full Chromium browser suite passed earlier, 188 of 188. CI arbitrates.
  • hotkeys.test.ts, hotkeyRules.test.ts, hotkeySheet.test.ts, pageImports.test.ts and core's switcher key.test.ts, which uses TanStack's matcher as its oracle, pass.
  • Chromium: the whole tier 1 suite, 188 passed, the new test included. Firefox: focus.spec.ts, 10 passed.
  • By hand on this worktree's pnpm dev: patchy init a tier 1 repo from the instance's release, which bundles the patched TanStack. I published a page with a sequence beside its first step's chord, a list's own ArrowDown, a field, and a native modal dialog in a HotkeyScope that closes from its Escape. Then I drove it in desktop Chromium as the dev persona:
    • G H fired the page's G and G H.
    • ArrowDown fired the list's in the list and the page's elsewhere.
    • Typing gh in the field fired nothing; Mod+K there fired.
    • Escape and Ctrl+Enter mid-composition, then Safari's committing Enter, fired nothing, and the field kept か.
    • In the dialog, S fired the dialog's and ArrowDown nothing. Mod+/ opened the sheet over it, listing Close, Save and the openers.
    • Escape closed the sheet alone, then the dialog's Escape closed the dialog, and the page's G H fired again.
    • ? opened and closed the sheet.
  • Not checked: Safari itself. The Safari keydown is replayed through Chrome's DevTools protocol, as the existing spec does.

Release impact

  • Breaking — requires action from anyone already running this
  • Not breaking — no action required

Bundled SDK dependency. patchy/hotkeys keeps its API and behaviour; published pages keep their own bundle until they are republished.

  • What does a revert leave behind? Nothing on the server: no schema, data or contract. Patches published in between carry the newer TanStack in their own bundle and keep working.
  • Does the release before it still work with that? Yes.

Claude Opus 5.5, T3 Code via Claude Code.

🤖 Generated with Claude Code

@github-actions github-actions Bot added area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:core Touches the core area area:docs Touches the docs area size:m 100-500 changed lines labels Nov 13, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Code review (GPT 6.1 Sol, xhigh) at 6ab88822: no blocker or should-fix findings.

Checked and held: upstream's input-method handling covers every case the old patch did (chords and sequences, Escape, Enter, arrows, modified keys, keyCode 229); the re-created sequence and Element hunks are faithful ports and the packages ship ESM and declarations only, so nothing is left unpatched; the Escape hunk removes only upstream's native-layer rule and matches patched 0.19.0 for modal dialogs and auto popovers, with one handler per press; the lockfile and the built SDK hold exactly one patched core; ADR-0011 and the license notices match the bundle.

One nit, fixed in b8709985 (comments only): two comments in packages/patchy/src/hotkeys.ts said TanStack's hooks use passive effects, which stopped being true in preact-hotkeys 0.19.2.

Not checked by the review or the author: Safari itself. Its keyCode 229 keydown is replayed through Chromium, as the existing spec does.

@allisonmahmood
allisonmahmood force-pushed the t3/update-tanstack-hotkeys branch from b870998 to 4410ac9 Compare November 13, 2026 16:44
allisonmahmood and others added 2 commits November 18, 2026 23:09
patchy/hotkeys bundles @tanstack/hotkeys 0.27.1 and @tanstack/preact-hotkeys
0.21.1, up from 0.19.0 and 0.17.1, and behaves as before.

Upstream now leaves keys to an input method while it composes, Safari's
keyCode 229 commit included, so the patch drops that part; a unit case pins
it. The patch is re-created on 0.27.1 for what upstream lacks: sequence
allowStep and onStep, a sequence on an element taking its keys first, and
Element targets. It also keeps a live Escape hotkey's key while a modal
dialog or popover is open, which upstream gave to the browser in 0.24 and the
hotkeys skill documents otherwise; a browser test covers the skill's
Escape-closes-the-dialog path.

TanStack Store left the bundle, so the release carries one TanStack notice.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tack 0.21

TanStack's Preact useHotkeys and provider use layout effects since 0.19.2, so
the comments above useBindings and inside HotkeyScope no longer describe it.
They now say what our own code does that upstream's hook doesn't, and that
the provider would activate the same scope.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the t3/update-tanstack-hotkeys branch from 4410ac9 to d215c2e Compare November 18, 2026 23:09
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked d215c2e1baa7e408be1d4ef246e36cd72c2acf90 (base f32691cc1877e2af574bf6b33be767299fa80382) on team and brightline, by GPT 6.2 Sol in T3 Code.

Done means

  • Frozen install passed. pnpm 12.20.0 accepted the committed lockfile with its release-age policy enabled. The lockfile's SHA-256 matched before and after install. A reverse dry run matched every hunk of the patch against the installed 0.27.1 core, which was shared by the workspace and the 0.21.1 Preact adapter.
  • Patch shortcuts passed. A repo initialized and published with the installed release fired G and G H inside its frame. Typing gh in an input fired neither, and Mod+K still fired there. The unit tests and Chromium covered composition, including Chromium replay of the committing keydown marked only by keyCode 229. Matcher probes also covered Wayland Ctrl+backtick, Polish Ctrl+Alt+A, NumLock-off numpad 5, and dotless i.
  • Switcher, native layers, and viewer setting passed. Mod+Shift+K opened the switcher from the frame, and Escape returned focus. The patch's own Escape handler unmounted its native modal dialog and its auto popover, released the scope, and reached no shell key listener. After Ben turned single-key shortcuts Off, G, G H, and ? stayed off in the published page while Mod+K and element-scoped ArrowDown still fired.
  • Release packaging passed. The unpacked release exports patchy/hotkeys and its types. The bundle's source maps showed one patched core at 0.27.1 and the Preact adapter at 0.21.1, with no TanStack Store. Its single TanStack MIT notice matched both installed packages.
  • Existing publication passed. Chromium opened the older published hotkeys fixture on this head and verified its shortcuts still worked.

Golden journeys

  • Publish a page passed. Ada published a single HTML file with the installed CLI. Ben opened it at its address and from Home. Retire removed it from Home and replaced the frame with its notice. Restore brought it back in both places.
  • Find and open a tool passed. Jordan opened Kudos in its frame after searching from Home.
  • Use a tool live passed. Jordan sent kudos and it appeared on Priya's already-open page.
  • Use a tier 2 tool passed. New Business loaded its sample deals. Jordan moved Saltwater Hotels Lead → Discovery → Lead on Allison's already-open board. Spend refused Jordan approving his own submitted request.

Evidence

  • Vitest reported 156 passed across five files, covering hotkeys, rules, sheet, page imports, and the switcher key matcher.
  • Chromium reported 76 passed across seven specs, including all 14 in hotkeys.spec.ts, the switcher and its relay, shortcut settings, focus, single-file serving, and tier 2 subscriptions.
  • The packed Preact e2e suite passed. A fresh consumer installed one copy of each Preact runtime and no standalone TanStack package, and its shortcuts worked in both Vite dev and the single-file build.
  • GitHub Actions on this head reported 190 passed in Chromium and 187 passed, 3 skipped in the required browser-firefox job. Chromium CI · Firefox CI

Rollback answers

Both match the diff. The change has no migration, persisted data shape, server contract, or infrastructure change. Publications keep their bundled dependencies at their existing version, including pages published with the new SDK if the release is reverted. No one-way label is needed.

Not run

  • Native Safari. The keyCode-229 behavior was checked with Chromium replay and matcher tests.

Notes

  • The rollback answers were checked against the diff and the older published fixture on this head. A full head-to-base server rollback was outside this run.

@allisonmahmood
allisonmahmood merged commit 2a17d16 into main Nov 18, 2026
28 checks passed
@allisonmahmood
allisonmahmood deleted the t3/update-tanstack-hotkeys branch November 18, 2026 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:core Touches the core area area:docs Touches the docs area size:m 100-500 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant