Skip to content

🎨 Palette: Add keyboard shortcut hint to global search - #448

Open
mkk2026 wants to merge 1 commit into
masterfrom
palette-ux-search-shortcut-743285040206422956
Open

🎨 Palette: Add keyboard shortcut hint to global search#448
mkk2026 wants to merge 1 commit into
masterfrom
palette-ux-search-shortcut-743285040206422956

Conversation

@mkk2026

@mkk2026 mkk2026 commented Jul 5, 2026

Copy link
Copy Markdown
Owner

💡 What:

Added a visual <kbd> hint for the / shortcut to the global search input on the dashboard. The hint automatically hides when the input has a value to reduce visual clutter. Implemented a keyboard event listener that focuses the search bar when / or Ctrl/Cmd+K is pressed.

🎯 Why:

To make the global search feature more discoverable and accessible for keyboard power users, allowing them to quickly jump to search without reaching for the mouse.

📸 Before/After:

Before: Search bar only had a placeholder. Users had to manually click it to focus.
After: Search bar displays a small kbd hint (/) on the right side. Pressing / instantly focuses the input. The hint disappears once the user starts typing.

♿ Accessibility:

  • The visual <kbd> hint is hidden from screen readers (aria-hidden="true") to prevent redundant audio noise.
  • The input's aria-label was updated to explicitly announce the shortcut to screen reader users: "Search articles, CVEs, or software (Press '/' to focus)".
  • The global shortcut handler carefully checks document.activeElement to ensure it doesn't intercept regular typing if the user is focused on another input, textarea, or contenteditable element.

PR created automatically by Jules for task 743285040206422956 started by @corebrimtech

Summary by CodeRabbit

  • New Features

    • Added a global keyboard shortcut to focus search using / or Ctrl/Cmd + K.
    • Added a visible shortcut hint next to search when the field is empty.
  • Accessibility

    • Improved search labeling to better communicate available keyboard shortcuts.
    • Shortcut handling now avoids interfering while typing in form fields.

Added a visual `<kbd>` hint (/) to the global search input and implemented the keyboard event listener to focus the input when `/` or `Cmd+K` is pressed. The shortcut is safely bypassed if the user is already typing in an input field. Also added an `aria-label` to announce the shortcut to screen readers.

Co-authored-by: corebrimtech <175357468+corebrimtech@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a global keyboard shortcut (/ or Ctrl/Meta+K) to focus the search input in the dashboard page, ignoring keystrokes typed into form fields. Updates the search input's aria-label and conditionally renders a keyboard hint icon, plus a journal documentation entry.

Changes

Global Search Shortcut

Layer / File(s) Summary
Keyboard shortcut handler and search input
src/app/page.tsx
Adds useRef import, searchInputRef, and a useEffect keydown listener that focuses the search input on / or Ctrl/Meta+K unless focus is already in an input/textarea/contentEditable element; updates the search input's aria-label and conditionally renders a / keyboard hint when the query is empty.
Journal documentation
.Jules/palette.md
Adds a journal entry describing the global search shortcut hint behavior.

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

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Document
  participant PageComponent
  participant SearchInput

  User->>Document: presses "/" or Ctrl/Meta+K
  Document->>PageComponent: keydown event
  PageComponent->>PageComponent: check activeElement is not a form field
  PageComponent->>SearchInput: focus()
  SearchInput-->>User: shows focused input, hides hint if query non-empty
Loading

Possibly related PRs

Poem

A rabbit taps "/" with a hop and a cheer,
The cursor jumps to the search box near.
No more clicking, no more delay,
Just a keystroke to find your way. 🐇⌨️
Thump-thump goes my joyful little paw!

🚥 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 clearly matches the main change: adding a keyboard shortcut hint for the global search.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch palette-ux-search-shortcut-743285040206422956

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/app/page.tsx

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.


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: 1

🧹 Nitpick comments (1)
src/app/page.tsx (1)

106-122: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider adding coverage for the new shortcut behavior.

No tests exercise the / or Ctrl/Cmd+K focus behavior or the guard against typing in other fields. Given this is a small, isolated, easily-testable interaction, a lightweight test (e.g., with Testing Library firing keydown events) would guard against regressions.

🤖 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/app/page.tsx` around lines 106 - 122, Add test coverage for the new
keyboard shortcut logic in the page component: the handleKeyDown behavior in
page.tsx should be exercised with tests that verify '/' and Ctrl/Cmd+K focus the
search input via searchInputRef, and that the guard early-returns when the
active element is an INPUT, TEXTAREA, or contentEditable element. Use a
lightweight Testing Library keydown test around the page component or the
relevant effect so this interaction stays protected from regressions.
🤖 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 @.Jules/palette.md:
- Line 26: The journal entry date in palette.md is out of chronological order;
update the heading for the “Added Global Search Shortcut Hints” entry so it
matches the surrounding 2026 entries. Locate the section by its “Added Global
Search Shortcut Hints” title and correct the date text to the intended 2026
value so the timeline remains ordered.

---

Nitpick comments:
In `@src/app/page.tsx`:
- Around line 106-122: Add test coverage for the new keyboard shortcut logic in
the page component: the handleKeyDown behavior in page.tsx should be exercised
with tests that verify '/' and Ctrl/Cmd+K focus the search input via
searchInputRef, and that the guard early-returns when the active element is an
INPUT, TEXTAREA, or contentEditable element. Use a lightweight Testing Library
keydown test around the page component or the relevant effect so this
interaction stays protected from regressions.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8a5911e5-9f1d-496a-a64f-b03633e9ef13

📥 Commits

Reviewing files that changed from the base of the PR and between 558fb10 and 79b11c3.

📒 Files selected for processing (2)
  • .Jules/palette.md
  • src/app/page.tsx

Comment thread .Jules/palette.md
## 2026-10-26 - Clearable Search Inputs
**Learning:** Search inputs without a quick reset mechanism force users to manually delete text, which is tedious on mobile.
**Action:** Always include a conditional "Clear" button (X icon) inside the input wrapper when text is present, ensuring `aria-label` is set for screen readers.
## 2024-05-24 - Added Global Search Shortcut Hints

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Journal entry date is out of chronological order.

This entry is dated 2024-05-24, but it's inserted after entries dated 2026-10-25 and 2026-10-26. Likely a typo for a 2026 date.

📝 Suggested fix
-## 2024-05-24 - Added Global Search Shortcut Hints
+## 2026-10-27 - Added Global Search Shortcut Hints
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## 2024-05-24 - Added Global Search Shortcut Hints
## 2026-10-27 - Added Global Search Shortcut Hints
🤖 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 @.Jules/palette.md at line 26, The journal entry date in palette.md is out of
chronological order; update the heading for the “Added Global Search Shortcut
Hints” entry so it matches the surrounding 2026 entries. Locate the section by
its “Added Global Search Shortcut Hints” title and correct the date text to the
intended 2026 value so the timeline remains ordered.

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