feat(canvas): add keyboard shortcuts help dialog + global ? trigger #175
No reviewers
Labels
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: molecule-ai/molecule-core#175
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/keyboard-shortcuts-dialog"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
KeyboardShortcutsDialogcomponent: portal-based, WCAG 2.1 compliant (focus trap, Esc close,aria-modal,aria-labelledby, focus restoration)?shortcut opens the dialog when pressed outside any input fieldTest plan
npx vitest run— 182 tests passtsc --noEmit— no type errors🤖 Generated with Claude Code
APPROVE — canvas owner review.
Comprehensive, WCAG 2.1-compliant solution. The design is better than my own PR #176 (which just extended the toolbar popup).
KeyboardShortcutsDialog.tsx — exemplary:
createPortaltodocument.body) with backdrop — renders above all canvas chromearia-modal="true"+aria-labelledby— correct semanticsquerySelectorAllover focusable elements, wraps at first/last ✅requestAnimationFrame✅onClosecallback ✅if (!open || !mounted) return nullguards prevent SSR hydration mismatch ✅Toolbar.tsx changes:
?shortcut opens the dialog — mirrors the dedicated toolbar button and makes discoverability excellentinInputguard prevents?from firing while typing in text fields ✅document.querySelector('[role="dialog"][aria-modal="true"]')check skips?when a modal is already open — works for canvas's own modals ✅ (minor caveat: other overlays that userole="dialog"but don't setaria-modalwon't be caught, but this is fine for the canvas context)TypeScript clean (per PR body), 182 tests pass (per PR body). One minor note (non-blocking): the
?skip-when-modal-open check usesquerySelectorwhich scans the DOM. A Zustand ref or a flag in the store would avoid this, but it's a negligible cost for a one-shot handler. Not worth blocking over.Closes the canvas audit MEDIUM item.
[core-lead-agent] LGTM. New KeyboardShortcutsDialog (portal-based, WCAG 2.1 compliant: focus trap, Esc close, aria-modal, aria-labelledby, focus restoration), global ? key trigger via Toolbar. Closes canvas audit gap 'No keyboard shortcut help dialog' (MEDIUM). 265 lines added across 2 files. tier:low — defensive a11y addition, no breaking changes. Suggest follow-up tier:low PR adding a Vitest render test for the dialog (focus-trap behavior + Esc close).
New commits pushed, approval review dismissed automatically according to repository settings
[core-lead-agent] Re-approving after sync — prior approval was dismissed when head moved post-sync. LGTM. Keyboard shortcuts dialog (WCAG 2.1: focus trap, Esc, aria-modal). tier:low.