Skip to content

fix(ui): derive keyboard shortcuts sheet from SHORTCUTS registry#3359

Closed
MattPua wants to merge 1 commit into
mainfrom
posthog-code/unify-keyboard-shortcuts-registry
Closed

fix(ui): derive keyboard shortcuts sheet from SHORTCUTS registry#3359
MattPua wants to merge 1 commit into
mainfrom
posthog-code/unify-keyboard-shortcuts-registry

Conversation

@MattPua

@MattPua MattPua commented Jul 10, 2026

Copy link
Copy Markdown
Member

Problem

The keyboard shortcuts modal and command palette showed different shortcuts — they were two independently hand-maintained lists that had drifted. E.g. RELOAD_WINDOW was bound and shown in the command palette but missing from the modal.

Changes

KEYBOARD_SHORTCUTS (the modal's data) is now derived from SHORTCUTS (the map already used everywhere for actual hotkey binding), via a SHORTCUT_META description map. Adding a new SHORTCUTS entry now fails to compile unless it's documented or explicitly excluded (HIDDEN_FROM_SHEET), so the two surfaces can't silently drift again.

Editor-keymap shortcuts (Tiptap bold/italic/etc.) that don't go through SHORTCUTS are kept as a small hand-written list, since there's no single source to derive them from.

How did you test this?

  • pnpm --filter @posthog/ui typecheck — passes
  • Added keyboard-shortcuts.test.ts asserting every bound key is documented in the sheet — passes
  • Ran full command test suite — 34 tests passing

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

The shortcuts modal and command palette were two hand-maintained lists
that drifted apart (e.g. RELOAD_WINDOW was bound and in the palette but
missing from the modal). KEYBOARD_SHORTCUTS is now derived from
SHORTCUTS, so a new binding must be documented or explicitly hidden or
the build fails.

Generated-By: PostHog Code
Task-Id: 7e2307b4-96be-4d1c-aba5-02a8344f99a1
@trunk-io

trunk-io Bot commented Jul 10, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 3a3a3d6.

@MattPua MattPua closed this Jul 10, 2026
@MattPua MattPua deleted the posthog-code/unify-keyboard-shortcuts-registry branch July 10, 2026 20:56
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