Skip to content

fix(Listbox): prevent autofocus to avoid breaking other focusable elements #2092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: v2
Choose a base branch
from

Conversation

kricsleo
Copy link
Collaborator

@kricsleo kricsleo commented Aug 3, 2025

resolves #2056

Previously, Listbox would automatically focus the highlighted item. This could interfere with other autofocusable elements, e.g., https://stackblitz.com/edit/rwxsez1n?file=src%2FApp.vue (the autofocus input wouldn't receive focus). This PR fixes this issue.

However, this PR doesn't completely resolve the keyboard navigation issue as described in the issue above. This is caused by scrollIntoView because it alters the starting point of keyboard navigation (Tab) (it's not entirely clear why scrollIntoView has this effect). We can't simply remove scrollIntoView, though, as automatically scrolling to the highlighted item seems more important than the keyboard navigation starting point, unless more issues are reported.

Copy link

pkg-pr-new bot commented Aug 3, 2025

Open in StackBlitz

npm i https://pkg.pr.new/reka-ui@2092

commit: 16eecec

@kricsleo kricsleo marked this pull request as draft August 3, 2025 14:22
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.

[Bug]: Listbox always autofocuses an item on mount
1 participant