Repository navigation
fix(naked_ui): scroll keyboard focus targets into view in overlays, tabs, toggle groups, and menubars - #344
Open
leoafarias wants to merge 4 commits into
Open
leoafarias wants to merge 4 commits into
leoafarias wants to merge 4 commits into
Conversation
…lays Home and End in an anchored overlay (NakedSelect, NakedMenu) requested focus directly on the first or last item, which skipped the traversal policy's requestFocusCallback. When the overlay content scrolled, End focused the last item without revealing it, so End then Enter selected an item the user could not see. Request focus through the policy, as the arrow keys already do.
…e groups, and menubars NakedTabBar Home and End, NakedToggleGroup arrow keys, Home, and End, and NakedMenubar Home and End requested focus directly on the target, which skipped the traversal policy's requestFocusCallback and left a target inside a scrollable off screen. Request focus through the policy's callback, as the arrow keys in tabs and the overlay fix already do.
Focusing through the traversal policy's default callback aligns the target to the trailing edge of every ancestor scrollable, even when it is already visible, which scrolled the page and shifted fully visible strip items. requestFocusInView runs the policy callback with keepVisibleAtEnd and then keepVisibleAtStart so a target is revealed from either side and left alone when visible. The anchored overlay, tabs, toggle group, and menubar use it, and MenubarTriggers.move now reveals the next trigger as well.
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. |
leoafarias
added a commit
that referenced
this pull request
Oct 27, 2026
…n stack # Conflicts: # packages/naked_ui/CHANGELOG.md
This was referenced Oct 27, 2026
An overlay is built under its anchor's scrollables but rendered in the Overlay. Scrollable.ensureVisible found those scrollables through the widget tree while each position picked its viewport through the render tree, so with an Overlay inside another scroll view (a nested Navigator in a PageView, or an app wrapped in a scroll view) the page was scrolled to an unrelated offset on Home and End. revealInView walks the containing scrollables like Scrollable.ensureVisible and stops at the first one that does not render the target. requestFocusInView now focuses the node and calls it.
leoafarias
added a commit
that referenced
this pull request
Oct 27, 2026
4 of 5 tasks
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
Several keyboard jumps in naked_ui requested focus directly on the target item:
MenubarTriggers.move).That skips the focus-traversal code that calls
Scrollable.ensureVisible. When the content scrolled, the target was focused but left off screen. In aNakedSelect, End then Enter selected an item the user could not see.MenubarTriggers.movecould open the next menu under a clipped, invisible trigger.All of these now call one internal helper,
requestFocusInView. It focuses the node, then reveals it withrevealInView:Scrollable.ensureVisible.ScrollPosition.ensureVisiblewithkeepVisibleAtEndand thenkeepVisibleAtStart. Each policy scrolls in only one direction, so the pair reveals the target from either side, in either reading direction, and across loop wraps.explicit, alignment 1) is not used, because it aligns the target to the trailing edge of every ancestor scrollable, even when the target is already visible.Overlay. When thatOverlaysits inside another scroll view (a nestedNavigatorin aPageView, or an app-wide scroll view with a list in the page), following the widget tree scrolled the page to an unrelated offset.Validation
NakedSelectand aNakedMenuwhoseOverlayis inside aPageViewof nestedNavigators, or inside an app-wide scroll view with a list in the page, reveal the item in the panel and leave every outer offset unchanged.move, and nested-scroll tests fail. The loop-wrap, right-to-left, and plain app-wide scroll view tests pass either way and guard the two-pass design.flutter testinpackages/naked_ui: 982 passed.dart analyze: no new issues. Rootdart format: clean.melos run ci:checks: passed.Related Issues
Found while reviewing #341, which makes a long
RemixSelectlist scroll. Belongs in the naked_ui 1.3.0 release with #317, #330, #335, #338, and #347. The combobox highlight reveal and the select focus-on-open fix (#349) build on this helper.Checklist
///). No API or documented behavior changed, so only the CHANGELOGUnreleasedentry was added.Breaking Change