Skip to content

feat(cardinal): switch between search input and results panel using arrow keys#194

Merged
ldm0 merged 2 commits intomasterfrom
query_results_switching
May 6, 2026
Merged

feat(cardinal): switch between search input and results panel using arrow keys#194
ldm0 merged 2 commits intomasterfrom
query_results_switching

Conversation

@ldm0
Copy link
Copy Markdown
Member

@ldm0 ldm0 commented May 1, 2026

fixes #189

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Enables seamless keyboard navigation between the search input and the files results list, addressing issue #189 by allowing ArrowDown to enter results (and ArrowUp to return to search) without requiring a mouse click.

Changes:

  • Add an onNavigateFromSearchToResults callback in useFilesTabState that triggers when ArrowDown reaches the newest history tail.
  • Update App to select the first result + blur the search input when navigating from search → results, and add separate focus helpers (focusSearchInput vs focusAndSelectSearchInput).
  • Extend global hotkey handling to return focus to the search input when ArrowUp is pressed on the first result row; update and add tests covering the new navigation flows.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
cardinal/src/hooks/useFilesTabState.ts Adds optional callback to transition from search input to results when ArrowDown hits history tail.
cardinal/src/hooks/useAppWindowListeners.ts Renames quick-launch focus handler to focusAndSelectSearchInput and updates effect deps accordingly.
cardinal/src/hooks/useAppHotkeys.ts Tracks activeRowIndex and adds ArrowUp behavior to move focus back to search from the first result.
cardinal/src/App.tsx Implements navigation from search → results (select first row + blur input) and introduces separate focus helpers.
cardinal/src/hooks/tests/useFilesTabState.test.ts Adds unit tests for ArrowDown-to-results behavior at history tail and modifier handling.
cardinal/src/hooks/tests/useAppWindowListeners.test.ts Updates tests to reflect focusAndSelectSearchInput rename.
cardinal/src/hooks/tests/useAppHotkeys.test.ts Updates tests for new options and adds coverage for ArrowUp from first result returning focus to search.
cardinal/src/tests/App.searchNavigation.test.tsx Adds integration-style test asserting ArrowDown from search selects first result and blurs search input.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ldm0 ldm0 merged commit 78826a5 into master May 6, 2026
14 checks passed
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