Skip to content

Global command palette (⌘K)#64

Merged
nmbrthirteen merged 3 commits into
mainfrom
feat/global-search
Jul 7, 2026
Merged

Global command palette (⌘K)#64
nmbrthirteen merged 3 commits into
mainfrom
feat/global-search

Conversation

@nmbrthirteen

@nmbrthirteen nmbrthirteen commented Jul 7, 2026

Copy link
Copy Markdown
Owner

A spotlight-style global search across the studio, replacing the page-scoped Assets search. Press ⌘K (or the sidebar Search button) on any page to search Pages, Clips, and Assets, with arrow-key navigation and Enter to jump. Built with the existing design tokens.

Summary by CodeRabbit

  • New Features
    • Added a global command palette for quick keyboard-driven navigation.
    • Open it with Ctrl/⌘+K or via the new Search button in the sidebar.
    • Search across pages, recent clips, and assets with grouped results and fast selection.
    • Supports keyboard navigation, click-to-open actions, and closing on Escape or outside click.

Spotlight search mounted app-wide: ⌘K or the sidebar Search button opens
a palette that searches pages, clips, and assets, with keyboard nav.
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@nmbrthirteen, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 49 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7471e62e-33fe-4db5-9725-7e0b6ac33319

📥 Commits

Reviewing files that changed from the base of the PR and between b6d8c11 and 8d87411.

📒 Files selected for processing (1)
  • src/ui/client/CommandPalette.tsx
📝 Walkthrough

Walkthrough

This PR adds a new CommandPalette React component providing keyboard-driven (Ctrl/⌘+K) search across Pages, Clips, and Assets, integrates it into Layout with a sidebar trigger button, and adds accompanying CSS for the overlay dialog and search results.

Changes

Command Palette

Layer / File(s) Summary
Command types and static data
src/ui/client/CommandPalette.tsx
Defines the Cmd type and static "Pages" command entries with a group-to-icon mapping.
Palette state and data fetching
src/ui/client/CommandPalette.tsx
Manages open/query/active-index state, global open/close listeners, input focus, and first-open fetching from /history and /assets.
Search filtering, grouping, and rendering
src/ui/client/CommandPalette.tsx
Builds and filters searchable command items (capped at 24), groups results by category, and renders the portal-based UI with keyboard navigation and click execution.
Layout wiring and styling
src/ui/client/Layout.tsx, src/ui/public/css/styles.css
Adds a sidebar "Search" button with ⌘K hint dispatching the open event, mounts CommandPalette in Layout, and adds CSS for the sidebar row and overlay dialog.

Estimated code review effort: 2 (Simple) | ~15 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Layout
  participant CommandPalette
  participant HistoryAPI as "/history"
  participant AssetsAPI as "/assets"

  User->>Layout: Click Search button or Ctrl/Cmd+K
  Layout->>CommandPalette: dispatch open-command-palette event
  CommandPalette->>HistoryAPI: fetch /history?limit=100
  CommandPalette->>AssetsAPI: fetch /assets
  HistoryAPI-->>CommandPalette: clip history data
  AssetsAPI-->>CommandPalette: asset entries
  CommandPalette->>CommandPalette: build grouped Cmd results
  User->>CommandPalette: type query / arrow keys / Enter
  CommandPalette->>CommandPalette: filter, navigate, execute command
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: a global command palette opened with ⌘K.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/global-search

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
src/ui/client/CommandPalette.tsx (1)

111-158: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add dialog ARIA semantics for the overlay.

The palette acts as a modal but lacks role="dialog"/aria-modal="true" and an accessible label for the input, so screen readers won't announce it properly when opened.

♿ Proposed ARIA additions
     <div className="cmdk-overlay" onClick={close}>
-      <div className="cmdk" onClick={(e) => e.stopPropagation()}>
+      <div className="cmdk" role="dialog" aria-modal="true" aria-label="Command palette" onClick={(e) => e.stopPropagation()}>
         <div className="cmdk-head">
           <Search size={17} className="cmdk-search-icon" />
           <input
             ref={inputRef}
+            aria-label="Search pages, clips, and assets"
             value={query}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/ui/client/CommandPalette.tsx` around lines 111 - 158, The command palette
overlay is functioning as a modal, but the root element returned by
CommandPalette lacks dialog semantics and the input is unlabeled for assistive
tech. Update the createPortal markup in CommandPalette to add role="dialog" and
aria-modal="true" on the .cmdk container (or the modal root), and provide an
accessible name via aria-label or aria-labelledby tied to the existing
header/search area. Also add an explicit label for the input in the cmdk-head
section so screen readers announce what the field is for.
src/ui/client/Layout.tsx (1)

54-59: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add ARIA attributes for the search trigger.

The button opens a modal-like command palette but lacks aria-haspopup/aria-expanded, and the ⌘K hint is hardcoded regardless of platform (Windows/Linux users use Ctrl+K). Neither is a functional blocker but both affect accessibility/UX polish for a command palette meant to be used app-wide.

♻️ Suggested improvement
-        <button className="sidebar-search" onClick={() => window.dispatchEvent(new Event("open-command-palette"))}>
+        <button
+          className="sidebar-search"
+          aria-haspopup="dialog"
+          onClick={() => window.dispatchEvent(new Event("open-command-palette"))}
+        >
           <Search className="ico" strokeWidth={1.8} size={15} />
           <span>Search</span>
-          <kbd>⌘K</kbd>
+          <kbd>{navigator.platform.includes("Mac") ? "⌘K" : "Ctrl K"}</kbd>
         </button>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/ui/client/Layout.tsx` around lines 54 - 59, The sidebar search trigger in
Layout should expose proper command-palette accessibility state and a
platform-appropriate shortcut hint. Update the button in Layout to include ARIA
metadata such as aria-haspopup and aria-expanded, wiring the expanded state to
the command palette visibility or open event source, and replace the hardcoded
“⌘K” display with a platform-aware shortcut label that shows Ctrl+K on
Windows/Linux and Cmd+K on macOS. Keep the changes localized to the search
button markup and any helper used to detect the current platform.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/ui/client/CommandPalette.tsx`:
- Line 73: The highlighted item in CommandPalette can get out of sync because
active is only reset when query changes, not when the results list updates as
clips/assets finish loading. Update the CommandPalette selection logic so active
is reset or clamped whenever the underlying results change, not just on query,
and adjust the related effect/order around the results rendering logic in
CommandPalette to keep the highlighted and Enter-selected item aligned with the
current list.
- Around line 64-71: The CommandPalette useEffect is marking loaded.current true
before the /history and /assets requests succeed, so a failed fetch permanently
prevents Clips/Assets from loading. Update the CommandPalette logic so each
source can retry when it fails: only set the loaded flag after successful
resolution, or track separate success/error state for the history and assets
requests in the useEffect callback. Also avoid swallowing errors silently so
reopen attempts can trigger another fetch.

---

Nitpick comments:
In `@src/ui/client/CommandPalette.tsx`:
- Around line 111-158: The command palette overlay is functioning as a modal,
but the root element returned by CommandPalette lacks dialog semantics and the
input is unlabeled for assistive tech. Update the createPortal markup in
CommandPalette to add role="dialog" and aria-modal="true" on the .cmdk container
(or the modal root), and provide an accessible name via aria-label or
aria-labelledby tied to the existing header/search area. Also add an explicit
label for the input in the cmdk-head section so screen readers announce what the
field is for.

In `@src/ui/client/Layout.tsx`:
- Around line 54-59: The sidebar search trigger in Layout should expose proper
command-palette accessibility state and a platform-appropriate shortcut hint.
Update the button in Layout to include ARIA metadata such as aria-haspopup and
aria-expanded, wiring the expanded state to the command palette visibility or
open event source, and replace the hardcoded “⌘K” display with a platform-aware
shortcut label that shows Ctrl+K on Windows/Linux and Cmd+K on macOS. Keep the
changes localized to the search button markup and any helper used to detect the
current platform.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c1f4ab13-5bb5-424c-8b01-e867b0c0dae2

📥 Commits

Reviewing files that changed from the base of the PR and between 79b5fa4 and b6d8c11.

📒 Files selected for processing (3)
  • src/ui/client/CommandPalette.tsx
  • src/ui/client/Layout.tsx
  • src/ui/public/css/styles.css

Comment thread src/ui/client/CommandPalette.tsx
Comment thread src/ui/client/CommandPalette.tsx Outdated
@nmbrthirteen nmbrthirteen merged commit 1d3ef03 into main Jul 7, 2026
6 checks passed
@nmbrthirteen nmbrthirteen deleted the feat/global-search branch July 7, 2026 09:41
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