Repository navigation
fix(Selector): a closed list opens on the selected option, never a disabled one - #8868
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Approval waits on an owner decision and five fixes. The Selector fix behaves as described and its FR8 record change is approved at this head, but the same opening rule also ships for MultiSelector and the public useMultiCombobox, and the MultiSelector record does not state it. An engineering owner needs to settle that rule in the MultiSelector record and record the decision by commenting /approve-spec <full head SHA> on the head that carries it, and the author may do so if they are an engineering owner. Because the fixes below need a new commit, FR8 needs that approval again on the new head.
- With a value selected,
MultiSelectornow opens on a disabled option after ArrowDown, Enter or a click, because the opening index is taken before the open list moves selected options to the top. - The Changeset says opening "never highlights a disabled option" and that
Selector"opens on the selected option with every key", which theMultiSelectorcase above and a searchSelectoropened by Enter, a press or typing contradict. - FR8 says opening highlights the selected option, but typing on a closed search
Selectoropens the list with nothing highlighted, so the exemption should name typing or leave it to the search behavior. - Line 35 of
useCombobox.doc.mjsand the dense descriptions in both hook docs still say ArrowDown and ArrowUp open on the first and last option. - The Changeset needs to name the hooks' old first-or-last opening and the accessibility target the fix serves, as the release rules require for a patch that changes documented keyboard behavior.
[Automated review]
|
/approve-spec 1c30c6f |
|
Posted by Cindy's agent on her behalf: the approval above covers a consistency edit to Selector FR8 (the opening highlight). Opening goes to the enabled selected option; otherwise ArrowUp goes to the last enabled option and any other opening to the first; a disabled option is never highlighted. This follows the WAI-ARIA listbox and select-only combobox patterns. |
Main moved Selector.spec.md to docs/specs/components/Selector and changed MultiSelector/hooks.ts. This merge takes main's MultiSelector hooks and doc as they are, so MultiSelector keeps its current opening highlight; that rule is a separate records question. Also from review: FR8 names typing among the search openings that highlight nothing; the changeset names the old first-or-last opening and the listbox target; useCombobox's docs and dense lines describe the selected-then-enabled opening; the keep-selected test uses an all-enabled list, so it fails without the fix.
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Selector | 99.6 kB (+36 B) · 17.4 kB CSS (0) | — | ✗ · ✓ · ✓ |
| SelectorOption | 20.9 kB (0) · 6.1 kB CSS (0) | — | ✗ · ✓ · ✓ |
| richtext/RichTextEditorToolbar | 277.8 kB (+51 B) · 454 B CSS (0) | — | — · — · — |
3 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Pagination | 109.7 kB (+41 B) · 17.8 kB CSS (0) | — | — · — · — |
| PowerSearch | 285.0 kB (+40 B) · 24.1 kB CSS (0) | — | — · — · — |
| CommandPalette | 73.1 kB (+30 B) · 12.7 kB CSS (0) | — | — · — · — |
Visual changes: 4 snapshots in 1 component
A change is a question for the reviewer, not a failure.
Package size: @astryxdesign/core 7.17 MB packed (+292 B); no new dependencies.
API changes: none in this pull request
Committed API report behind this build: cli 29 rows, core 34 rows, theme-butter 1 row, theme-y2k 1 row; run pnpm api:report.
Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
|
/approve-spec 99e5202 |
There was a problem hiding this comment.
Changes requested for one fix to the pull request text; the code change itself is in good shape, component:Selector FR8 is approved at this head, and the new tests fail on main and pass here.
- The title, the description and
Fixes #8832still describe aMultiSelectoranduseMultiComboboxfix that this head no longer makes (packages/core/src/MultiSelector/hooks.tsstill opens on index 0 and the last index), so please retitle tofix(Selector): a closed list opens on the selected option, never a disabled one, reference #8832 without a closing keyword so its MultiSelector half stays open, and drop MultiSelector from the description (the test file has 8 Selector cases, all failing onmain).
Editing the title and description creates no commit, so the FR8 approval stays valid. Optional: the options.value hook doc could keep the search-list exception, and a press or Space case would pin the remaining FR8 opening paths.
[Automated review]
|
/approve-spec 7353e71 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet because the pull request is still a draft; it runs once the pull request is marked ready for review.
component:Selector FR8 is approved at this head, the new Selector.openHighlight.test.tsx cases fail on main and pass here, and the title and description now cover only the Selector half of #8832, as requested earlier.
Optional, non-blocking:
- The
options.valuehook doc could keep the search-list exception: a search list opened by a press or Enter highlights nothing. - A press or Space case would pin the two FR8 opening paths the tests do not cover yet.
[Automated review]
| type: 'string', | ||
| description: | ||
| 'The selected value. Without search, opening by a press, Enter or Space highlights it, or the first option when nothing is selected; ArrowDown and ArrowUp open on the first and last option.', | ||
| 'The selected value. Opening the list highlights it when it is enabled; otherwise ArrowUp opens on the last enabled option and ArrowDown, a press, Enter or Space on the first. A disabled option is never highlighted on opening, and with no enabled option nothing is.', |
There was a problem hiding this comment.
Non-blocking: with hasSearch, a press or Enter opens with nothing highlighted, even when the selected option is enabled (FR8, and the options.hasSearch doc below). Keeping that exception here would make this entry true on its own, for example: "Opening the list highlights it when it is enabled, except that a search list opened by a press or Enter highlights nothing; otherwise ArrowUp opens on the last enabled option and ArrowDown, a press, Enter or Space on the first."
…m the previous list (#8871) * fix(Selector, MultiSelector): a closed list opens on the selected option, never a disabled one * docs(Selector): record the opening highlight (FR8); hook docs and changeset * fix(Selector, MultiSelector): a query change no longer keeps the highlight from the previous list With hasSearch, the highlight was an index into the filtered list that survived query changes: after arrowing and typing it named another option, or one past the end, so aria-activedescendant pointed at nothing rendered and Enter picked an option the user never moved to, or nothing. Selector (component:Selector FR9): each query change highlights the first enabled match of the new list, as the library's Typeahead does. MultiSelector (component:MultiSelector FR11): each query change clears the highlight, because with a row highlighted Left and Right move into a row's action cell instead of the caret (FR10), and Enter with nothing highlighted creates (FR9); ArrowDown then starts at the first match. Both adjust during render as the query changes. Selector.searchHighlight.test.tsx; the Selector cases fail on main. Stacked on #8868 (opening highlight, FR8). * fix(Selector): a query reset on close is no new list, so a reopened search list highlights nothing CodeBunny: closing a searchable Selector reset the query, and the FR9 render-time adjust then highlighted the first option, so a list reopened by a press or Enter started on it and Enter replaced the value, against FR8. The adjust now highlights the first enabled match only while the list is open; a reset while closed clears the highlight. Also: MultiSelector FR11 and the changeset say ArrowDown starts at Select all or the create row when shown; the MultiSelector comment and test cite MultiSelector FR11; FR11's table row gets its review-state cell; FR9's verification row names the failing-before case (ArrowDown to Cherry, then 'ap'), now a test, and the reopen case. * Merge remote-tracking branch 'refs/remotes/l4/main' into lane4/x8871 # Conflicts: # .changeset/selector-opens-on-selected.md # docs/specs/components/Selector/Selector.spec.md # packages/core/src/MultiSelector/MultiSelector.spec.md # packages/core/src/MultiSelector/MultiSelector.tsx # packages/core/src/MultiSelector/hooks.ts # packages/core/src/Selector/Selector.openHighlight.test.tsx # packages/core/src/Selector/Selector.tsx # packages/core/src/Selector/hooks.ts * fix(Selector, MultiSelector): place the query reset after its inputs, and match main's trigger name MultiSelector reads searchQuery and setHighlightedIndex, so its reset sits after the combobox hook. A searchable Selector's trigger name now carries the selected value, so the tests match its leading label. * fix(Selector): a query change clears the highlight, as MultiSelector's does Highlighting the first match on every query change would be automatic selection, which FR8 does not allow for a search list opened by typing. Selector now clears the highlight like MultiSelector: ArrowDown starts at the first enabled match, and Enter with nothing highlighted does what it did before. FR9, its verification row and the changeset say so. * test(Selector, MultiSelector): the clear cases keep the old index inside the new list Arrowing to Apricot before typing b leaves an index inside the two-row list, so main highlights Blueberry and these cases fail there. FR9 states that Enter with nothing highlighted selects nothing, and two comments keep only their reasons.












Part of #8832 (its
Selectorhalf; theMultiSelectorhalf stays open).User impact
A keyboard user opening a closed
Selectorwith the arrow keys can land on an option that can't be picked. ArrowDown highlights option 0 and ArrowUp the last option, disabled or not, so the list opens with a disabled option active and Enter does nothing. ArrowDown also ignores the current value: with "Hard" selected, ArrowDown then Enter changes the value to "Easy", while the same keys after a click keep "Hard".After this change every way of opening a
Selectorlands on an option a person can pick: the selected one when there is one, otherwise the first (ArrowUp: last) enabled one.Problem and solution fit
useComboboxopens from closed withsetHighlightedIndex(0)orselectableItems.length - 1, without checkingdisabledor the value. Click, Enter and Space use the selected index but fall back to 0, which can also be disabled.aria-activedescendantnames an option that can't be chosen, and a habitual ArrowDown, Enter silently replaces the value.One helper (
findOpeningIndex) now decides the opening highlight for every opening path.Expected behavior and authority
component:SelectorFR8 (approved by the specs owner):MultiSelectoranduseMultiComboboxare unchanged. Extending the rule there is a separate owner question (which of several selected options to highlight, and the open list moves selected options to the top).Smallest restoration
Selector/hooks.ts(useCombobox):findOpeningIndex(fromEnd)for closed ArrowDown, ArrowUp, the trigger press, and Enter/Space.useCombobox.doc.mjssaid ArrowDown and ArrowUp open on the first and last option; it now describes the rule.Evidence
Selector.openHighlight.test.tsx, 8 cases, all failing onmain. ArrowDown and ArrowUp open on "Archived" or "Retired" (both disabled) instead of "Hard" or the first or last enabled option; an all-disabled list still names an active option; ArrowDown then Enter on an all-enabled list picks "Easy" instead of keeping "Hard".useCombobox, CommandPalette and listbox/combobox binding suites (16 files, 580 tests). CommandPalette usesuseComboboxalways-open, so its opening path doesn't run.Scope
Testing
vitestfor Selector and MultiSelector (16 files, 580 tests);pnpm check:knowledge; the comment-provenance baseline check.Writing rubric results