Skip to content

fix(Selector, MultiSelector): the highlight keys are held back while a sheet open waits to load - #13843

Merged
cixzhang merged 2 commits into
meta:mainfrom
HelloOjasMutreja:fix/selector-held-open-navigation-keys
Nov 27, 2026
Merged

cixzhang merged 2 commits into
meta:mainfrom
HelloOjasMutreja:fix/selector-held-open-navigation-keys

Conversation

@HelloOjasMutreja

@HelloOjasMutreja HelloOjasMutreja commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Closes #13751

User impact

While a Selector or MultiSelector waits for its bottom sheet to load, there is no list to move a highlight across, yet the Arrow, Home, End and Page keys still moved it. The sheet then opened on whatever option those keys had reached instead of its normal opening option.

Change

As decided on the issue ("go with holding the keys back"): in the onKeyDown of useComboboxInternal (Selector) and useMultiComboboxInternal (MultiSelector), a press of ArrowDown, ArrowUp, Home, End, PageUp or PageDown while isOpen && !isListShown is prevented and does nothing else. In a MultiSelector grid (options with an action), ArrowLeft and ArrowRight are held back too, so they cannot move the highlight onto the opening row's action cell. Enter, Space and a second press were already held back the same way. Type-to-select letters during the hold are not covered here; they are tracked in #13858. The isListShown option comment in both hooks is shorter, with the one claim it needs.

I did not add the optional refinement from the issue (a closed-trigger key such as ArrowUp or End replacing the held open with its own opening option). The closed-trigger handler is unchanged, and the held open keeps the first key's opening option.

Verification

  • The held-open test in Selector.sheetHeldInputs.test.tsx and the one in MultiSelector.sheetLoad.test.tsx now press ArrowDown, End, PageDown, ArrowUp, Home and End during the hold, then check that the sheet opens with the first option (Red, Bug) as aria-activedescendant. The MultiSelector test uses a grid, presses ArrowRight twice as well, and checks that the sheet opens on the Bug row, not its action cell. Each fails with its guard removed.
  • The Selector (26 files, 391 tests) and MultiSelector (8 files, 300 tests) suites pass. ESLint and tsc report nothing in the changed files.
  • changeset-coverage and check:changesets pass with the added [fix] changeset.
  • No screenshot: nothing renders differently, the change is which key presses reach the highlight state. Checked in jsdom only, not in a browser.

…a sheet open waits to load (meta#13751)

During a held open there is no list to move across, so ArrowDown, ArrowUp,
Home, End, PageUp and PageDown no longer move the highlight; the sheet opens
at its opening option. The isListShown comment is shorter.
@vercel

vercel Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 26, 2026 10:37pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 26, 2026
@astracat-bot

astracat-bot Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 26, 2026, 11:52 PM UTC

@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 30ede3c

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
MultiSelector · Storybook 109.3 kB (+54 B) · 19.2 kB CSS (0) 2,861 (+17) ✓ · ✓ · ✓
richtext/RichTextEditorToolbar 298.1 kB (+53 B) · 454 B CSS (0) — — · — · —
Pagination 154.9 kB (+51 B) · 20.3 kB CSS (0) — — · — · —
4 more components
Component Size LoC Visual · A11y · RTL
Selector 121.6 kB (+49 B) · 20.0 kB CSS (0) — ✓ · ✓ · ✓
PowerSearch 325.9 kB (+48 B) · 27.7 kB CSS (0) — — · — · —
CommandPalette 87.5 kB (+45 B) · 14.0 kB CSS (0) — — · — · —
SelectorOption 25.4 kB (0) · 6.8 kB CSS (0) — ✓ · ✓ · ✓

Package size: @astryxdesign/core 8.09 MB packed (+333 B); no new dependencies.

Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@cixzhang cixzhang added ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) labels Nov 26, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 9cac595

@cixzhang
cixzhang marked this pull request as draft November 26, 2026 20:16
@cixzhang
cixzhang marked this pull request as ready for review November 26, 2026 20:16

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the guard holds the six vertical and jump keys as intended, but two things still need fixing.

  • In a MultiSelector whose options carry an action (a grid), ArrowLeft and ArrowRight pressed during the held open still move the highlight to the opening row's action cell (packages/core/src/MultiSelector/hooks.ts:70-77, :272-293), so the sheet opens on that cell and Enter fires the action instead of toggling, which the changeset says no longer happens; add both keys to MultiSelector's held keys with a grid case in MultiSelector.sheetLoad.test.tsx, or narrow the changeset to the six keys.
  • The description says the held open "takes no key that picks, toggles or moves the highlight", but in a list without search a typeahead letter still moves it (packages/core/src/Selector/Selector.tsx:1778-1781, packages/core/src/MultiSelector/hooks.ts:147-151), as do the grid arrows above; please narrow that sentence to the keys the guard holds.

The /approve-spec on this commit covers spec records, and this pull request changes none, so it does not settle these two code points. Non-blocking: the new isListShown JSDoc runs to 29 words and says a key cannot close the list, while Escape and Tab still end a held open. Lint and typecheck pass; the unit suites run once review passes.

Claims and files checked

Review mode: same-head; reason: none

  • Changeset: the highlight no longer moves on Arrow, Home, End, PageUp or PageDown while the sheet loads, and the sheet opens at its normal opening option. False for ArrowLeft and ArrowRight in a grid MultiSelector (MultiSelector/hooks.ts:70-77, :272-293); true for the six keys (Selector/hooks.ts:610-613, MultiSelector/hooks.ts:261-264).
  • Title and commit message: the six highlight keys are held back while a sheet open waits to load, and the isListShown comment is shorter. Verified, same lines.
  • Before this change, those keys moved the highlight during the load and the sheet opened there. Verified: the base key cases had no hold check.
  • During the hold, the six keys are prevented and do nothing else. Verified (Selector/hooks.ts:610-613, MultiSelector/hooks.ts:261-264).
  • Enter, Space and a second press were already held back. Verified (Selector/hooks.ts:561-564, :656-659; MultiSelector/hooks.ts:193-196, :332-335).
  • The held open now takes no key that picks, toggles or moves the highlight. False: typeahead letters and the grid inline arrows still move it.
  • The isListShown comment is shorter, with one claim. Shorter, verified; its wording says more than the code (non-blocking).
  • The optional refinement is not added, and the closed-trigger handling is unchanged. Verified: the guard needs isOpen, and the closed paths are untouched.
  • Both tests press the keys during the hold and expect the first option (Red, Bug). Verified (Selector.sheetHeldInputs.test.tsx:101-105, :119-123; MultiSelector.sheetLoad.test.tsx:141-145, :162-168).
  • Each test fails with the guard removed. Verified by reading: the final End would leave the last option highlighted.
  • The Selector and MultiSelector suites pass. Not yet confirmed: CI's unit suites are deferred until review passes.
  • ESLint and tsc report nothing in the changed files. Verified: CI's lint and typecheck pass at this commit.
  • The changeset checks pass. Changeset coverage verified (CI's lint step passes); check:changesets was not run in this review.
  • Nothing renders differently, and the change was checked in jsdom only. Verified: the change is key handling only.
  • .changeset/selector-held-open-highlight-keys.md: its Arrow claim is too broad (first finding).
  • packages/core/src/MultiSelector/hooks.ts: first finding; comment wording (non-blocking).
  • packages/core/src/MultiSelector/MultiSelector.sheetLoad.test.tsx: clear; it has no grid case (part of the first fix).
  • packages/core/src/Selector/hooks.ts: clear, apart from comment wording (non-blocking).
  • packages/core/src/Selector/Selector.sheetHeldInputs.test.tsx: clear.

Automated review (maintainer link)

Comment thread packages/core/src/Selector/hooks.ts Resolved
Comment thread packages/core/src/Selector/hooks.ts Resolved
@cixzhang

Copy link
Copy Markdown
Contributor

🤖 (Posted by Cindy's agent.) Thank you for building this, @HelloOjasMutreja! It works as intended: on a slow first load, pressing End or ArrowDown before the sheet appears now opens it at its opening option instead of jumping, and warm opens are unchanged.

One small request in this pull request, if you're up for it: MultiSelector's grid also moves between cells with ArrowLeft and ArrowRight, so please add those two keys to the held set for MultiSelector, with one grid case (two presses during the hold, then the sheet opens on the opening row's option cell, not its action cell), and list them in the changeset. Type-to-select letters during the hold are a separate follow-up, so a line in the description saying they're not covered here would help.

If you'd rather keep this one narrow, that's fine too: then please make the changeset and description say it covers the six keys (Arrow up/down, Home, End, Page up/down) only.

@cixzhang

Copy link
Copy Markdown
Contributor

🤖 (Posted by Cindy's agent.) A quick update to my note above, after the automated review: in a MultiSelector whose rows have action buttons, ArrowLeft or ArrowRight during the hold can move the highlight onto a row's action, so Enter then runs that action instead of toggling the option. So for MultiSelector, please do add ArrowLeft and ArrowRight to the held keys (with the grid case) rather than only narrowing the description. The description should also say that type-to-select letters aren't covered yet. Thanks again!

…heet open loads (meta#13751)

In a grid, the inline arrows moved the highlight onto the opening row's
action cell during the held open, so the sheet opened there and Enter ran
the action instead of toggling. They are held back too, with a grid case in
the sheet-load test, and the changeset says type-to-select is not covered.
The isListShown and guard comments are shortened to what the code does.
@HelloOjasMutreja

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Both points are addressed in 30ede3c.

  • ArrowLeft and ArrowRight are now held back too in a MultiSelector grid (isGrid only, so the caret in a search input still moves). The held-open test uses a grid with an action on the first row, presses ArrowRight twice during the hold, and checks that the sheet opens on the Bug row and not its action cell. It fails with those two keys removed from the guard. The changeset lists them.
  • The description now says type-to-select letters during the hold are not covered here, and no longer claims the held open takes no key that moves the highlight.
  • The isListShown comment is shortened as suggested, in both hooks, and the guard comment keeps only the reason.

The Selector and MultiSelector suites pass (691 tests), and ESLint, Prettier, tsc and both changeset checks are clean.

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. CI has run on this head and passed, including the Selector and MultiSelector suites.

The held-open guard covers the six highlight keys in both hooks and, in a grid MultiSelector, ArrowLeft and ArrowRight, and both updated tests pin the opening option. The optional comment-wording suggestion inline still stands, and typing a letter during the hold stays a separate follow-up, as the description says.

Claims and files checked

Review mode: same-head; reason: none

  • Changeset: a loading sheet no longer moves the highlight on Arrow, Home, End, PageUp or PageDown. Verified (Selector/hooks.ts:609-612, MultiSelector/hooks.ts:260-268).
  • Changeset: a MultiSelector with option actions no longer moves it on ArrowLeft or ArrowRight. Verified (MultiSelector/hooks.ts:264; MultiSelector.sheetLoad.test.tsx:153-155, :175).
  • Changeset: the sheet opens at its normal opening option. Verified by the tests (Selector.sheetHeldInputs.test.tsx:119-123, MultiSelector.sheetLoad.test.tsx:172-176).
  • Changeset and description: type-to-select letters are not covered. Accurate: typeahead runs before the guard (MultiSelector/hooks.ts:253, Selector.tsx:1844).
  • Changeset: a patch fix for @astryxdesign/core. Verified: only Core source changes.
  • Before this change, those keys moved the highlight during the load and the sheet opened there. Verified: the base key cases had no hold check.
  • During the hold the six keys are prevented and the hook does nothing else for them. Verified (same lines as above).
  • In a grid, ArrowLeft and ArrowRight are held, so they cannot reach the opening row's action cell. Verified (MultiSelector/hooks.ts:264, ahead of the grid branch at :276).
  • Enter, Space and a second press were already held back. Verified on the base (Selector/hooks.ts:551, :638; MultiSelector/hooks.ts:183, :314).
  • The isListShown comment is shorter, with the one claim it needs. Verified (Selector/hooks.ts:399-405, MultiSelector/hooks.ts:60-65).
  • The optional refinement is not added, and the closed-trigger handling is unchanged. Verified: the guard needs isOpen, and the closed paths are untouched.
  • Both tests press the keys during the hold and expect the first option (Red, Bug); the MultiSelector test uses a grid, presses ArrowRight twice and expects the Bug row, not its action cell. Verified (Selector.sheetHeldInputs.test.tsx:101-105, :119-123; MultiSelector.sheetLoad.test.tsx:117-131, :148-155, :165-178).
  • Each test fails with its guard removed. Verified by reading: End leaves the last option highlighted, and ArrowRight leaves the action cell active.
  • The Selector (26 files, 391 tests) and MultiSelector (8 files, 300 tests) suites pass. Verified: CI ran those files and tests on this head, all passing.
  • ESLint and tsc report nothing in the changed files. Verified: CI's lint and typecheck jobs pass on this head.
  • changeset-coverage and check:changesets pass. Verified: CI's lint job passes both.
  • Nothing renders differently, and the change was checked in jsdom only. Verified: the change is key handling only.
  • Title and both commit messages: verified against the same lines.
  • .changeset/selector-held-open-highlight-keys.md: clear.
  • packages/core/src/MultiSelector/hooks.ts: clear; one optional comment-wording suggestion.
  • packages/core/src/MultiSelector/MultiSelector.sheetLoad.test.tsx: clear.
  • packages/core/src/Selector/hooks.ts: clear.
  • packages/core/src/Selector/Selector.sheetHeldInputs.test.tsx: clear.

Automated review (maintainer link)

}

// While an open waits for its list, no option shows. The open keeps its
// opening option, and in a grid the inline arrows cannot reach an action.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking (comment style): this sentence joins two topics. One topic per sentence keeps only the reason:

      // While an open waits for its list, no option shows. The open keeps its
      // opening option. In a grid it keeps the option cell.

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 30ede3c

@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Nov 27, 2026
@cixzhang
cixzhang merged commit 73ca17f into meta:main Nov 27, 2026
148 of 151 checks passed
@cixzhang

Copy link
Copy Markdown
Contributor

🤖 (Posted by Cindy's agent.) Merged, thank you @HelloOjasMutreja! While a Selector or MultiSelector sheet is still loading, the highlight keys (and ArrowLeft/ArrowRight in a MultiSelector grid) no longer move a highlight nobody can see, so the sheet opens at its opening option, and Enter can't run a row's action by mistake. Thanks also for turning the review round around so quickly. Type-to-select during the hold is tracked in #13858 if you'd like to take it on next.

This branch was successfully deployed

1 active deployment
Preview — 30ede3ca Deployed Nov 26, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants