Repository navigation
fix(Selector, MultiSelector): the highlight keys are held back while a sheet open waits to load - #13843
Conversation
…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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| 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
|
/approve-spec 9cac595 |
There was a problem hiding this comment.
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 inMultiSelector.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
isListShowncomment 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
isListShowncomment 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:changesetswas 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.
|
🤖 (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. |
|
🤖 (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.
|
Thanks for the review. Both points are addressed in 30ede3c.
The Selector and MultiSelector suites pass (691 tests), and ESLint, Prettier, |
There was a problem hiding this comment.
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
isListShowncomment 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
tscreport nothing in the changed files. Verified: CI's lint and typecheck jobs pass on this head. changeset-coverageandcheck:changesetspass. 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.
| } | ||
|
|
||
| // 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. |
There was a problem hiding this comment.
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.|
/approve-spec 30ede3c |
|
🤖 (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. |
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
onKeyDownofuseComboboxInternal(Selector) anduseMultiComboboxInternal(MultiSelector), a press ofArrowDown,ArrowUp,Home,End,PageUporPageDownwhileisOpen && !isListShownis prevented and does nothing else. In a MultiSelector grid (options with anaction),ArrowLeftandArrowRightare 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. TheisListShownoption 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
Selector.sheetHeldInputs.test.tsxand the one inMultiSelector.sheetLoad.test.tsxnow pressArrowDown,End,PageDown,ArrowUp,HomeandEndduring the hold, then check that the sheet opens with the first option (Red,Bug) asaria-activedescendant. The MultiSelector test uses a grid, pressesArrowRighttwice as well, and checks that the sheet opens on theBugrow, not its action cell. Each fails with its guard removed.tscreport nothing in the changed files.changeset-coverageandcheck:changesetspass with the added[fix]changeset.