Skip to content

feat(sdk-app): keyboard shortcuts with on-screen helper#1732

Merged
jeffredodd merged 2 commits intomainfrom
feat/sdk-app-hide-chrome-shortcut
May 8, 2026
Merged

feat(sdk-app): keyboard shortcuts with on-screen helper#1732
jeffredodd merged 2 commits intomainfrom
feat/sdk-app-hide-chrome-shortcut

Conversation

@jeffredodd
Copy link
Copy Markdown
Contributor

@jeffredodd jeffredodd commented May 7, 2026

Summary

  • New ? key opens a modal listing every keyboard shortcut. The sidebar now shows a small Press ? for shortcuts hint above the search input that also opens the modal on click.
  • Keyboard shortcuts available now:
    • ? — Show keyboard shortcuts (toggle)
    • \ — Hide chrome (TopBar / Sidebar / Events Log)
    • Esc — Restore chrome when hidden, or close the shortcut modal
    • Cmd/Ctrl + , — Open settings
    • Cmd/Ctrl + . — Toggle design / development
    • Cmd/Ctrl + ; — Cycle theme (system → light → dark)
  • useGlobalShortcut gained an optional modifier: 'mod' flag (Cmd on Mac, Ctrl elsewhere). Modifier shortcuts fire even when focus is in an input; un-modified shortcuts still ignore typing targets so plain ?/\ don't fire from the search box.
  • Modifier symbol in the helper auto-adapts: on Mac, Ctrl on Windows/Linux.

Screenshots

Screenshot 2026-05-07 at 6 38 16 PM Screenshot 2026-05-07 at 6 38 09 PM Screenshot 2026-05-07 at 6 38 01 PM

Why

Two motivations bundled here:

  1. For screen-shares and customer demos we want the SDK component to fill the viewport without sdk-app's own chrome bleeding through. \ is the lightweight alternative to Feature 4 (selectable demo chromes).
  2. The shortcut set has grown enough that nothing surfaces them. The helper modal makes them discoverable, scales as we add more, and does so without permanent UI clutter — only a small hint above the sidebar search.

The punctuation choice for the modifier shortcuts (, . ;) was deliberate: letter combos with Cmd/Ctrl conflict with browser defaults that often can't be intercepted (e.g. Cmd+T is reserved by Chrome on macOS). Punctuation under Cmd/Ctrl has no OS or browser conflicts on Mac/Windows/Linux. Cmd+, doubles as the macOS preferences convention.

Test plan

Chrome toggle (commit 1):

  • On any /category/Component route, press \ — TopBar, Sidebar, Events Log disappear; floating "Show chrome" pill appears bottom-left.
  • Press \ again, or Esc, or click the pill — chrome restored.
  • Click into the sidebar search field, type \ — chrome stays visible and the field receives the character.
  • Hide chrome, refresh — chrome stays hidden.
  • Verify Cmd+\ / Ctrl+\ / Alt+\ do not trigger the toggle.

Shortcut helper (commit 2):

  • "Press ? for shortcuts" hint is visible above the sidebar search input, left-aligned.
  • Click the hint — modal opens listing every shortcut.
  • Press ? outside any input — modal opens; press ? again or Esc — modal closes.
  • Type ? inside the sidebar search field — modal does NOT open; field receives the character.
  • Click backdrop — modal closes.
  • Hide chrome with \, then press ? — modal still opens. Esc dismisses (and restores chrome).
  • Modifier symbol shows on Mac, Ctrl on Windows/Linux.

Modifier shortcuts (commit 2):

  • Cmd/Ctrl + , opens the settings panel.
  • Cmd/Ctrl + . toggles between Development and Design mode (URL switches between / and /design).
  • Cmd/Ctrl + ; cycles theme: system → light → dark → system. The data-theme attribute on <html> updates accordingly.
  • All three modifier shortcuts work with focus inside the sidebar search input.
  • None of the modifier shortcuts conflict with browser defaults (no save dialog, no bookmark, no print).

Branch base

This branch stacks on top of feat/sdk-app-manual-token-mode (#1727). Re-target to al/create-secondary-ui-components once that PR merges.

🤖 Generated with Claude Code

@jeffredodd jeffredodd changed the title feat(sdk-app): hide chrome with backslash shortcut feat(sdk-app): keyboard shortcuts with on-screen helper May 8, 2026
@jeffredodd jeffredodd marked this pull request as ready for review May 8, 2026 01:48
@jeffredodd jeffredodd force-pushed the feat/sdk-app-manual-token-mode branch 2 times, most recently from bdcd454 to 470e9da Compare May 8, 2026 15:35
Base automatically changed from feat/sdk-app-manual-token-mode to main May 8, 2026 15:41
jeffredodd and others added 2 commits May 8, 2026 08:44
Pressing \ toggles the TopBar, Sidebar, and Events Log so the rendered
SDK component takes the full viewport — useful for screen shares and
demos. Pressing Escape (or clicking the floating "Show chrome" pill in
the bottom-left) restores. State persists in localStorage. The keydown
listener is filtered to ignore inputs, textareas, contenteditables, and
elements with role="textbox"/"combobox", so typing \ in a search field
still types a backslash.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Press ? to open a modal listing all shortcuts.
- New Cmd/Ctrl shortcuts: , (settings), . (design/dev toggle),
  ; (cycle theme: system → light → dark).
- Sidebar hint above the search input opens the helper on click.
- useGlobalShortcut now supports an optional `modifier: 'mod'` flag
  (Cmd on Mac / Ctrl elsewhere); modifier shortcuts fire even when
  focus is in an input.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jeffredodd jeffredodd force-pushed the feat/sdk-app-hide-chrome-shortcut branch from 26692fd to 9d86618 Compare May 8, 2026 15:44
@jeffredodd jeffredodd merged commit 05e59d9 into main May 8, 2026
19 checks passed
@jeffredodd jeffredodd deleted the feat/sdk-app-hide-chrome-shortcut branch May 8, 2026 15:50
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