Skip to content

Selector: navigation keys during a held sheet open, and a shorter isListShown comment (from #12075) #13751

Done

Description

@cixzhang

🤖 (Posted by Cindy's agent.) Follow-ups from the review of #12075 (a Selector's bottom sheet loads on first use).

While a tap or key press waits for the sheet to load (a "held open"), #12075 keeps a second press, Enter and Space from closing the sheet or picking an option. Two smaller points remain:

  1. Arrow, Home, End and Page keys during a held open still move the highlighted option before the sheet shows. Nothing is picked, and the sheet opens on the option the keys reached, so no one picks an option they can't see, but these keys could be held back the same way Enter is, so the highlight starts where a person expects when the sheet appears.
  2. The isListShown comment in the combobox hooks could be shorter.

Done when: the navigation keys during a held open behave as decided (held back, or documented as buffered), with a test, and the comment is trimmed.

Activity

  1. HelloOjasMutreja commented on Nov 25, 2026

    @HelloOjasMutreja
    Contributor

    I read useComboboxInternal in packages/core/src/Selector/hooks.ts on current main, and this looks small enough that I would like to confirm the choice before I write it.

    Where it stands. During a held open (isOpen && !isListShown), three inputs are already held back: a second trigger click returns early in onTriggerClick, and Enter and Space break before they can select. The ArrowDown, ArrowUp, Home, End, PageUp and PageDown cases have no such guard, so they still move highlightedIndex. The sheet then opens on whatever those keys reached.

    Proposal (hold them back). Give those six cases the same guard Enter has, so the highlight stays where the open placed it (findOpeningIndex) until the list is shown. That matches how the other held inputs behave, keeps the opening highlight predictable, and needs one shared check in the handler rather than six. The alternative is to document the keys as buffered, which leaves the current behavior and a sheet that can open on an option the person never saw highlighted.

    Also in this issue. I would shorten the isListShown comment on UseComboboxInternalOptions and keep its one claim: a held open repeats instead of closing the list or picking an unseen option. MultiSelector/hooks.ts takes the same option, so I would check it moves in step.

    Test. One case in Selector.sheetHeldInputs.test.tsx: during the held open, the navigation keys leave the opening highlight alone, and after the frame arrives the sheet opens on that option. A MultiSelector case if its hook shares the guard.

    Hold back, or document as buffered? I will start once there is an answer.

  2. cixzhang commented on Nov 25, 2026

    @cixzhang
    ContributorAuthor

    🤖 (Posted by Cindy's agent.) Thanks for reading it so carefully, @HelloOjasMutreja, and for checking before writing it! A maintainer decision: go with holding the keys back.

    While an open is held (the sheet is still loading, so no list is shown yet), there's no option to move a highlight across. So Arrow, Home, End and Page keys shouldn't move the highlight during the hold; the sheet opens at its normal opening option. The rule is that the latest action before the sheet loads is held and replayed once when it loads: a later action replaces a held one rather than adding to it.

    One optional refinement: if a Selector's closed-trigger keys normally open at a different option (for example, ArrowUp or End opening at the last option), the latest such key may replace the held open with that key's opening option. That replaces the open; it still doesn't move a highlight step by step.

    For tests: a navigation key during a held open leaves the opening option unchanged (or replaces it by that rule), and the sheet opens with that option highlighted. The shorter isListShown comment and the MultiSelector check you mentioned fit in the same change. You're welcome to go ahead!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions