Skip to content

Focus search inputs for immediate typing - #13264

Merged
AmethystLiang merged 2 commits into
mainfrom
focus-on-search-input-after-opening-search
Aug 9, 2026
Merged

AmethystLiang merged 2 commits into
mainfrom
focus-on-search-input-after-opening-search

Conversation

@AmethystLiang

Copy link
Copy Markdown
Contributor

Problem

Search inputs across the app don't automatically receive focus when opened, requiring users to click before they can start typing.

Solution

Add autoFocus to search input fields so users can type immediately:

  • AutomationListSearchField: Always autofocus the input
  • SettingsSidebar: Autofocus only when navigating to Settings directly (not when deep-linked to a specific pane, since those panes own focus)
  • WorktreeParentPickerPopover: Switch to modal mode with manual focus management via onOpenAutoFocus / onCloseAutoFocus callbacks, since the virtual anchor has no DOM trigger for Radix to restore focus to
  • command.tsx: Forward ref from CommandInput wrapper to underlying CommandPrimitive.Input

Testing

  • New test verifies AutomationListSearchField autofocuses on mount
  • Updated e2e test confirms search input receives focus when opening Settings

- Autofocus inputs in AutomationListSearchField, SettingsSidebar, and WorktreeParentPickerPopover
- Only autofocus Settings search when opening directly, not via deep-link
- Use modal mode and explicit focus management in popover for proper restoration
- Forward CommandInput ref and add autofocus test coverage
@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b0d566aa-f8ee-452b-8e32-695ca897623e

📥 Commits

Reviewing files that changed from the base of the PR and between 08eab3c and 349fdde.

📒 Files selected for processing (3)
  • src/renderer/src/components/automations/AutomationListSearchField.test.tsx
  • src/renderer/src/components/sidebar/WorktreeParentPickerPopover.test.ts
  • src/renderer/src/components/sidebar/WorktreeParentPickerPopover.tsx

📝 Walkthrough

Walkthrough

The change adds autofocus to the automation search input. Settings enables search autofocus for ordinary openings and disables it for navigation-targeted openings. The worktree parent picker now uses modal focus handling, focuses its search input on open, and restores focus to the anchor container on close. CommandInput forwards refs to its underlying input. Component and end-to-end tests verify the updated focus behavior.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem, solution, and tests, but it omits the required Screenshots, AI Review Report, Security Audit, and Notes sections. Add all required template sections, including visual-change status, completed testing checklist, AI review findings with cross-platform checks, security audit, and notes.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: search inputs receive focus for immediate typing.
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

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
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3343b2b8-c5c0-453a-b92f-3aa9c4ff7a7d

📥 Commits

Reviewing files that changed from the base of the PR and between 8a061b9 and 08eab3c.

📒 Files selected for processing (7)
  • src/renderer/src/components/automations/AutomationListSearchField.test.tsx
  • src/renderer/src/components/automations/AutomationListSearchField.tsx
  • src/renderer/src/components/settings/Settings.tsx
  • src/renderer/src/components/settings/SettingsSidebar.tsx
  • src/renderer/src/components/sidebar/WorktreeParentPickerPopover.tsx
  • src/renderer/src/components/ui/command.tsx
  • tests/e2e/settings-search-shortcuts-pane.spec.ts

- Find the nearest focusable ancestor of the anchor row to restore focus
  to instead of letting it drop on the detached input element
- Simplify focus assertion in AutomationListSearchField test to verify
  actual focus behavior rather than autofocus attribute presence
@AmethystLiang
AmethystLiang merged commit 8a773a5 into main Aug 9, 2026
43 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* Focus search inputs for immediate typing

- Autofocus inputs in AutomationListSearchField, SettingsSidebar, and WorktreeParentPickerPopover
- Only autofocus Settings search when opening directly, not via deep-link
- Use modal mode and explicit focus management in popover for proper restoration
- Forward CommandInput ref and add autofocus test coverage

* Restore focus when closing worktree parent picker popover

- Find the nearest focusable ancestor of the anchor row to restore focus
  to instead of letting it drop on the detached input element
- Simplify focus assertion in AutomationListSearchField test to verify
  actual focus behavior rather than autofocus attribute presence
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