Repository navigation
fix(naked_ui): open a NakedSelect on its selected option - #349
Open
leoafarias wants to merge 6 commits into
Open
leoafarias wants to merge 6 commits into
leoafarias wants to merge 6 commits into
Conversation
NakedSelect opened with focus on the overlay container, so a selected option below the fold stayed hidden and the first Arrow Down went to the first option instead of the one after the selection. AnchoredOverlay takes an optional initialFocus node; NakedSelect hands its selected option that node, and once the overlay is built focus moves to the option and it is revealed through requestFocusInView. A select with no selected option, a disabled one, or one a lazily built list has not built still opens on the container.
… keep panel focus A select without a selected option, or whose selected option is disabled or not built yet in a lazy list, opened on the overlay container, so its first Arrow Down reached the first option and Enter did nothing. WAI-ARIA's listbox pattern, Radix Select, and Material's DropdownButton start on the first enabled option. AnchoredOverlay now falls back to the first focusable item through the traversal policy, as Home does, and reveals it. The container's autofocus is back, and the initial focus request leaves focus alone when something else in the panel already holds it, so a search field that focuses itself in initState is not overridden. AnchoredOverlay.initialFocus is now initialFocusNode, as in the dialog. NakedSelectOption values must be unique: equal values share the selected option's focus node. The RemixSelect test compares the focused option's value; checking for the option's text also matched while the container held focus.
…inter Items cleared keyboard focus on hover enter, which also fires when a list scrolls under a pointer that has not moved. After the select revealed its selected option, the first Arrow Down scrolled the list and dropped focus to the container. Items now clear keyboard focus on pointer hover, which only arrives when the pointer moves, and a disabled item ignores it as before. NakedMenu shares the base and keeps clearing focus when the pointer moves onto an item.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
4 of 5 tasks
4 of 5 tasks
A submenu row cleared keyboard focus and scheduled its hover open from hover enter, which also fires when a list scrolls under a pointer that has not moved. Arrowing past a submenu row under a resting mouse sent focus to the container and opened the submenu after its hover delay. Hover enter still sets the hovered flag and cancels ancestor timers; clearing item focus and scheduling the open now wait for a hover that moves the pointer, and a disabled row ignores it.
The select Home and End test now presses Arrow Down once, so it starts away from both edges instead of on the last option. The search-field case without a selection puts the field after the options, so a request that takes focus from it fails the test. Stale first-option comments are fixed. The docs say a field that requests focus while the panel builds keeps it, while a TextField with autofocus requests it after the build and loses to the initial focus, and describe the fallback as the first item that can take focus, as Home does. The reveal is documented as scrolling the scrollables that contain the item, and the hover comment says the delta check guards synthetic hovers.
leoafarias
added a commit
that referenced
this pull request
Oct 27, 2026
…stack # Conflicts: # packages/naked_ui/CHANGELOG.md
This was referenced Oct 28, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
NakedSelectopened with focus on the overlay container. A selected option below the fold stayed hidden, and the first Arrow Down went to the first option instead of the one after the selection.requestFocusInViewfrom fix(naked_ui): scroll keyboard focus targets into view in overlays, tabs, toggle groups, and menubars #344. Escape still returns focus to the trigger.DropdownButtonstart there too.TextField(autofocus: true)applies its autofocus later and loses to the initial focus.NakedSelectandNakedMenu.NakedSelectOptionvalues must be unique within a select; this is now documented.The internal
AnchoredOverlaygets aninitialFocusNode.NakedMenuand the other overlays do not pass one and keep today's behavior.Validation
New tests in
naked_select_test.dartcover:RemixSelectgets tests for the selected item and for the first item without a selection.All new and updated tests fail without the change, except two guards that pin the pointer behavior that must not change. Mutations of each guard in the code fail the intended test.
Full naked_ui suite: 1001 passed. Full remix suite: 2833 passed.
dart analyze, format, andmelos run ci:checks: clean.Merge note
Merge after #344. Tests elsewhere in the stack assume a select opens on its container:
mainfirst: after rebasing this PR, delete the Arrow Down and pump after opening inregistry_source/test/heroui/select_test.dart"keyboard focus rings an item without moving it". The select now opens on the first item, which matches HeroUI's own keyboard-open state.packages/remix/test/rendering/remix_box_effects_slots_test.dart, measure Beta rather than Alpha in the SelectMenuItem effects case. Alpha is already focused on open; ArrowDown focuses Beta. This preserves the idle/focused pixel and full-layout assertions (27 effects tests pass on integration).Long listspress counts.The integration branch (#339) shows these changes.
Related Issues
Stacked on #344; merge after it. Belongs in naked_ui 1.3.0.
Checklist
///).Breaking Change
No API change. A select without a value now opens on its first option, so the first Arrow Down reaches the second option and Enter selects the first. Before, focus started on the overlay container.