Skip to content

feat(devtools): Handle keyboard shortcuts with TanStack Hotkeys - #582

Draft
KevinVandy wants to merge 2 commits into
mainfrom
feat/use-tanstack-hotkeys
Draft

KevinVandy wants to merge 2 commits into
mainfrom
feat/use-tanstack-hotkeys

Conversation

@KevinVandy

Copy link
Copy Markdown
Member

🎯 Changes

Moves every keyboard handler in @tanstack/devtools to TanStack Hotkeys and removes @solid-primitives/keyboard and the devtools' own key matching (utils/hotkey.ts).

  • Packaging: @tanstack/hotkeys is a dependency, so an app that also uses it shares one hotkey manager with the devtools. @tanstack/solid-hotkeys is bundled with the devtools' own Solid copy (bundleSolid in tsup.config.ts).
  • Config (breaking): openHotkey is a hotkey string, 'Control+~' by default. inspectHotkey takes modifier names, with Mod in place of CtrlOrMeta. Saved settings and config values in the old format fall back to the config or the default.
  • Open and close: the open hotkey skips text fields and key repeat, as before. Escape now yields to an open dialog or popover of the app. In the modal host (openAsModal), Escape targets the host dialog. A close request that reaches the host with focus outside it closes the panel, which replaces the capture-phase Escape guard.
  • Trigger: Escape (or Shift+Escape) cancels a drag or throw, and it's live only during one, so it doesn't shadow the app's own Escape hotkey. Alt+M now works on macOS, where Option+M types µ, and it no longer fires in text fields. The tooltip labels come from formatForDisplay.
  • Source inspector: createHeldKeys plus resolveModifier, active while exactly the configured modifiers are held.
  • Widget keys: the panel resize separator, pane splitters, keyboard tab moves and the marketplace section header register createHotkeys targeted at their elements. Escape while moving a tab now cancels the move without also closing the panel.
  • Settings: createHotkeyRecorder records the open shortcut and rejects one the app already registered (detectConflicts). The inspect keys are toggle buttons with platform labels.
  • Scope: all devtools hotkeys are in the tanstack-devtools scope. The docs describe how it interacts with the app's global and exclusive scopes.

Settings tab keyboard section

Bundle size

Brotli, from size-limit. Base is main at 912849c, which has the same code as 1ff6734 (the one later commit edits a README). The limit moves from 86 KB to 102 KB. Most of the increase is the @tanstack/hotkeys core, which size-limit counts even though it's an external dependency.

Entry Base PR Change
packages/devtools/dist/index.js 84,465 B 101,278 B +16,813 B (+19.9%)
packages/event-bus-client/dist/esm/plugin.js 1,188 B 1,188 B 0 B
packages/devtools-webmcp/dist/esm/register.js 897 B 897 B 0 B
packages/devtools-webmcp/dist/esm/noop.js 36 B 36 B 0 B

Notes

Draft because of two gaps in the Picture-in-Picture window that need fixes in @tanstack/hotkeys. Element-targeted hotkeys keep listening on the document they were registered in, so the tab-move, splitter and section-header keys stop working after Solid moves those nodes into the PiP document. HotkeyRecorder listens only on the main window, so recording a shortcut doesn't work inside PiP.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm test:pr, or these tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Every keyboard handler in @tanstack/devtools now registers with
@tanstack/solid-hotkeys, bundled with the devtools' own Solid copy.
@tanstack/hotkeys becomes a dependency, so an app that also uses it
shares one hotkey manager. @solid-primitives/keyboard and the
devtools' own key matching are removed.

- openHotkey is a hotkey string ('Control+~'). inspectHotkey takes
  modifier names, with Mod in place of CtrlOrMeta. Saved settings in
  the old format fall back to the config or the default.
- The settings tab records the open shortcut and rejects one the app
  already registered.
- Escape yields to an open dialog or popover of the app. In the modal
  host it targets the host dialog, and a close request that reaches
  the host closes the panel.
- The trigger's Escape is live only during a drag or throw, so it
  doesn't shadow the app's own Escape hotkey.
- Widget keys (resize separators, pane splitters, keyboard tab moves,
  the marketplace section header) target their elements.
- The devtools bundle size limit moves from 86 KB to 102 KB.
@changeset-bot

changeset-bot Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cd7a133

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@tanstack/devtools Minor
@tanstack/devtools-example-angular-panel Patch
@tanstack/angular-devtools Patch
@tanstack/preact-devtools Patch
@tanstack/react-devtools Patch
@tanstack/solid-devtools Patch
@tanstack/svelte-devtools Patch
@tanstack/vue-devtools Patch
@tanstack/devtools-example-angular-a11y-devtools Patch
@tanstack/devtools-example-angular-basic Patch
@tanstack/devtools-example-angular-with-devtools Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 28, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@socket-security

socket-security Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​tanstack/​solid-hotkeys@​0.27.09310010098100
Added@​tanstack/​hotkeys@​0.37.010010010098100

View full report

@nx-cloud

nx-cloud Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit cd7a133

Command Status Duration Result
nx run-many --target=test:e2e --parallel=1 --pr... ✅ Succeeded 1m 18s View ↗
nx affected --targets=test:eslint,test:sherif,t... ✅ Succeeded 12s View ↗
nx run-many --targets=build --exclude=examples/... ✅ Succeeded 4s View ↗

💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-11-28 04:58:48 UTC

@pkg-pr-new

pkg-pr-new Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
More templates

@tanstack/angular-devtools

npm i https://pkg.pr.new/@tanstack/angular-devtools@582

@tanstack/devtools

npm i https://pkg.pr.new/@tanstack/devtools@582

@tanstack/devtools-a11y

npm i https://pkg.pr.new/@tanstack/devtools-a11y@582

@tanstack/devtools-bundler-core

npm i https://pkg.pr.new/@tanstack/devtools-bundler-core@582

@tanstack/devtools-client

npm i https://pkg.pr.new/@tanstack/devtools-client@582

@tanstack/devtools-rspack

npm i https://pkg.pr.new/@tanstack/devtools-rspack@582

@tanstack/devtools-ui

npm i https://pkg.pr.new/@tanstack/devtools-ui@582

@tanstack/devtools-utils

npm i https://pkg.pr.new/@tanstack/devtools-utils@582

@tanstack/devtools-vite

npm i https://pkg.pr.new/@tanstack/devtools-vite@582

@tanstack/devtools-webmcp

npm i https://pkg.pr.new/@tanstack/devtools-webmcp@582

@tanstack/devtools-event-bus

npm i https://pkg.pr.new/@tanstack/devtools-event-bus@582

@tanstack/devtools-event-client

npm i https://pkg.pr.new/@tanstack/devtools-event-client@582

@tanstack/preact-devtools

npm i https://pkg.pr.new/@tanstack/preact-devtools@582

@tanstack/react-devtools

npm i https://pkg.pr.new/@tanstack/react-devtools@582

@tanstack/solid-devtools

npm i https://pkg.pr.new/@tanstack/solid-devtools@582

@tanstack/svelte-devtools

npm i https://pkg.pr.new/@tanstack/svelte-devtools@582

@tanstack/vue-devtools

npm i https://pkg.pr.new/@tanstack/vue-devtools@582

commit: cd7a133

The react-vite specs dispatched synthetic keydown events on window, the
target @solid-primitives/keyboard listened on. TanStack Hotkeys listens
on the document, so press Control+Shift+Backquote, which types ~.

This branch has not been deployed

No deployments
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.

1 participant