Skip to content

fix(naked_ui): scroll the highlighted combobox option into view - #350

Open
leoafarias wants to merge 3 commits into
fix/naked-ui-overlay-boundary-scrollfrom
fix/naked-ui-combobox-reveal
Open

leoafarias wants to merge 3 commits into
fix/naked-ui-overlay-boundary-scrollfrom
fix/naked-ui-combobox-reveal

Conversation

@leoafarias

Copy link
Copy Markdown
Collaborator

Description

NakedCombobox keeps its highlight in RawAutocomplete and never moves focus, so nothing scrolled a highlighted option that sat outside a scrolling options list. Five Arrow Downs highlighted an option below a 120px list.

An option now reveals itself, just far enough, in the frame after its index becomes the highlight, and when the options view opens with the highlight outside the viewport. Focus stays on the field.

  • The reveal uses fix(naked_ui): scroll keyboard focus targets into view in overlays, tabs, toggle groups, and menubars #344's revealInView. An option that is already visible leaves the list and the page alone, and scrollables that do not render the option are not scrolled. That covers a host page, or a PageView around a nested Navigator.
  • NakedCombobox remembers the highlight index it last revealed and resets it when the options view unmounts. It reveals only when the index changes, so scrolling a lazily built list by hand toward the highlight is not pulled back, whether by wheel, drag, or jump, and whether or not the options are keyed.

Documented limitations:

  • Opening replaces a scroll offset the caller set when the highlight is outside it.
  • A highlighted option that a lazily built list has not built is not revealed. One example is the last option after Ctrl or Cmd with Arrow Down.

Validation

  • New tests on a 30-option, 120px list:

    • Arrow Down and Arrow Up reveal each option, and a visible option does not scroll.
    • Filtering leaves a scrolled-away list alone, with keyed and unkeyed options.
    • Reopening by Arrow Down or by typing reveals the highlight.
    • A ListView.builder keeps the user's position after a wheel scroll, drag, or jump back.
    • A nested Navigator in a PageView keeps the route and page offsets.
    • Horizontal lists work in LTR and RTL.

    Each fails when the fix, the claim, the unmount reset, or fix(naked_ui): scroll keyboard focus targets into view in overlays, tabs, toggle groups, and menubars #344's boundary rule is removed.

  • packages/naked_ui: full suite 995 passed. dart analyze: one existing info. Root format and melos run ci:checks: clean.

Related Issues

Stacked on #344; merge after it. Belongs in naked_ui 1.3.0.


Checklist

  • My PR includes unit or integration tests for all changed/updated/fixed behaviors.
  • I have updated or added relevant documentation (doc comments with ///).
  • I am prepared to follow up on review comments in a timely manner.

Breaking Change

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

NakedCombobox keeps its highlight in RawAutocomplete and never moves focus, so
nothing scrolled a highlighted option that sat outside a scrolling options
list: five ArrowDowns highlighted an option below a 120px list.

An option now reveals itself after the frame in which it becomes highlighted,
including when the list is reopened with the highlight still set. The reveal is
the one requestFocusInView uses, now shared through revealInView: end then
start, so the option scrolls just far enough from either side and in either
reading direction, and an option that is already visible leaves the list and
the page alone.
# Conflicts:
#	packages/naked_ui/lib/src/utilities/focus_in_view.dart
Revealing from each option's initState made a lazily built list jump when the
user scrolled back toward the highlight: the option is disposed while far away
and rebuilt on the way back, and the rebuilt option revealed itself again.

NakedCombobox now remembers the highlighted index it last revealed and the
option reveals itself only when that index changes. The memory resets when the
options view unmounts, so reopening still reveals the highlight. The reveal is
the revealInView from the #344 update, which stops at scrollables that do not
render the option.

Document that opening replaces a caller-set scroll offset when the highlight is
outside it, and that an unbuilt highlighted option in a lazy list is not
revealed.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T22:15:59.213809Z 15c2250 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
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