Skip to content

feat(ui): Focus first searched item in selects#117450

Open
nsdeschenes wants to merge 7 commits into
masterfrom
nd/feat-ui-focus-first-searched-item-in-selects
Open

feat(ui): Focus first searched item in selects#117450
nsdeschenes wants to merge 7 commits into
masterfrom
nd/feat-ui-focus-first-searched-item-in-selects

Conversation

@nsdeschenes

Copy link
Copy Markdown
Contributor

This PR updates the compact select so that it will highlight the first item in the list when the user searches for an item in the list, reducing some friction.

As well, a new prop is added in to control this feature, so it can be disabled if needed.

nsdeschenes and others added 5 commits June 11, 2026 15:10
Make searchable compact selects mark the first visible enabled result as active while keeping focus in the search input. Selecting with Enter now accepts that active search result, and callers can disable the behavior with search.autoFocusFirstResult.

Co-Authored-By: OpenAI Codex <noreply@example.com>
Add aria-activedescendant for the search input when it keeps DOM focus while an option is active. Clear the active descendant when real focus moves into the result list so visual and assistive focus stay in sync.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
Avoid auto-selecting stale search results when CompactSelect is configured for server-side filtering with filter: false.

Keep active-result autofocus enabled for client-filtered search, while preserving an explicit autoFocusFirstResult override.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
Scroll virtualized lists to the search-focused option so aria-activedescendant always references a rendered element. This preserves keyboard and screen reader behavior after the user searches from a scrolled virtualized menu.

Add a regression test for virtualized CompactSelect search focus.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
Stop exporting an internal helper that is only used within CompactSelect internals so knip does not report it as an unused public export.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 11, 2026
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Story previews

Preview the stories changed in this PR on the Vercel deployment:

Preview deployment: https://sentry-plwowtwe1.sentry.dev

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a53f9f9. Configure here.

Comment thread static/app/components/core/compactSelect/list.tsx
Recompute the current first visible search result when Enter is pressed instead of reading the search-focused key from a later effect. This prevents Enter from selecting a stale option when the query changes and the previous active key remains visible.

Add a regression test for Enter immediately after a search query update.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
Add comments explaining how CompactSelect coordinates virtual focus between the search input and registered option lists.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
@nsdeschenes nsdeschenes marked this pull request as ready for review June 12, 2026 13:50
@nsdeschenes nsdeschenes requested a review from a team as a code owner June 12, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant