Skip to content

feat: add command palette for quick page switching (⌘+P) #1107

@sw-factory-automations

Description

@sw-factory-automations

Description

Search usage is consistently low relative to page views across all feedback digests (5 searches vs 77 page views in the May 14 digest, similar ratios in prior weeks). The current search is sidebar-only and requires clicking the input or pressing ⌘+K. A command palette (⌘+P) — the standard quick-switcher pattern used by Notion, VS Code, and Linear — would provide a faster, more discoverable way to navigate between pages without leaving the keyboard.

The command palette would be a modal dialog with a search input that filters pages by title, showing recent pages first when the input is empty. This is distinct from the sidebar search (⌘+K), which searches page content via full-text search. The command palette is for fast navigation by title; the sidebar search is for finding content.

Acceptance Criteria

  • ⌘+P (Mac) / Ctrl+P (Windows/Linux) opens a centered modal command palette
  • The palette shows recently visited pages when the input is empty (reuse RecentPageVisit data)
  • Typing filters pages by title (client-side filter on the workspace's page list, not full-text search)
  • Results show page icon, title, and parent breadcrumb (e.g., "Parent Page → Child Page")
  • Database pages show the grid icon (Table2) to distinguish from regular pages
  • Arrow keys navigate results, Enter opens the selected page, Escape closes the palette
  • The palette closes after navigation
  • The shortcut is listed in the keyboard shortcuts dialog under the "Global" section
  • ⌘+P is suppressed from the browser's default print dialog via e.preventDefault()
  • The palette does not open when a text input or textarea is focused (prevent conflicts)
  • E2E test: open palette, type a page name, navigate with arrow keys, press Enter, verify navigation
  • E2E test: open palette with empty input, verify recent pages are shown
  • pnpm lint && pnpm typecheck && pnpm test pass

Dependencies

None

Technical Notes

  • Use cmdk (shadcn/ui's Command component wraps this) for the palette UI. Run npx shadcn@latest add command to add the component.
  • Register the ⌘+P shortcut in the app layout or a global hook, similar to how ⌘+\ is registered in sidebar-context.tsx.
  • The page list is already available in the sidebar context. Reuse the same data source rather than making a separate API call.
  • Recent visits are already tracked via RecentPageVisit in src/lib/types.ts and fetched in the workspace home page. Consider lifting this to a shared hook or context.
  • Follow the keyboard shortcut registration pattern in src/components/sidebar/sidebar-context.tsx.
  • Add the shortcut to getShortcutSections() in src/components/keyboard-shortcuts-dialog.tsx.
  • Reference .agents/conventions.md for component patterns.

Approval Required

This is a HIGH risk change:

  • Adds a new dependency (cmdk via shadcn/ui Command component)
  • Introduces a new navigation paradigm alongside the existing sidebar search
  • Overrides the browser's default ⌘+P (print) behavior
  • Requires careful conflict avoidance with existing shortcuts (⌘+K for search/link)

Comment "approved" to release this to the automation queue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-humanNeeds human input — automation will re-queue when user respondspriority:3

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions