fix(ui): derive keyboard shortcuts sheet from SHORTCUTS registry#3359
Closed
MattPua wants to merge 1 commit into
Closed
fix(ui): derive keyboard shortcuts sheet from SHORTCUTS registry#3359MattPua wants to merge 1 commit into
MattPua wants to merge 1 commit into
Conversation
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
|
Merging to
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 |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The keyboard shortcuts modal and command palette showed different shortcuts — they were two independently hand-maintained lists that had drifted. E.g.
RELOAD_WINDOWwas bound and shown in the command palette but missing from the modal.Changes
KEYBOARD_SHORTCUTS(the modal's data) is now derived fromSHORTCUTS(the map already used everywhere for actual hotkey binding), via aSHORTCUT_METAdescription map. Adding a newSHORTCUTSentry 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
SHORTCUTSare 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— passeskeyboard-shortcuts.test.tsasserting every bound key is documented in the sheet — passescommandtest suite — 34 tests passingAutomatic notifications
Created with PostHog Code