Skip to content

fix(core): MultiSelector search trigger no longer carries aria-required - #12123

Closed
josephfarina wants to merge 3 commits into
mainfrom
josephfarina/multiselector-search-required
Closed

josephfarina wants to merge 3 commits into
mainfrom
josephfarina/multiselector-search-required

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

User impact

A required MultiSelector with hasSearch puts aria-required="true" on its trigger, which is a plain <button> in that mode (the search box is the combobox). ARIA does not allow aria-required on a button, so accessibility checkers flag it (axe aria-allowed-attr) and assistive technology may ignore it or report it inconsistently. A form template that uses a required, searchable MultiSelector shows the error.

Problem and solution fit

  • Why does it occur? The trigger's shared props always set aria-required from the field's required state. The role-less search trigger receives it too.
  • Why does it harm the task? A checker reports an invalid attribute, and screen readers can't rely on it to announce the required state.
  • Why does it matter? A required field must still say so before the list opens, so dropping the attribute alone would lose the information.

The fix copies what Selector already does in the same case. The search trigger drops aria-required. The closed trigger states "required" through the field label's visible marker, which is part of its name, or through a visually hidden "Required" description when the marker is not shown (for example, in a form whose default is required). The search box carries aria-required while the list is open.

  • Shared rule: the required-with-search logic lives in one function, resolveSearchTriggerRequired, in the existing hooks/useResolvedRequired.ts module beside useResolvedOptionality, which both selectors already use. It returns the trigger's aria-required and whether the hidden "Required" description is needed; each component keeps rendering that description. Selector's behavior is unchanged; its existing tests pass.
  • Record: MultiSelector's accessibility contract gains one paragraph saying it follows component:Selector AR1's required rule through the shared implementation, plus a verification-map row for MultiSelector.searchRequired.test.tsx.

Expected behavior and authority

Selector's record describes this behavior for its search mode: no aria-required on the role-less trigger, the required text in the closed trigger's name or description, and aria-required on the search input while open. MultiSelector shares the input-field contract and should behave the same. The ARIA spec lists aria-required as unsupported on the button role.

Smallest restoration

  • aria-required on the trigger only when it is a combobox (no search, or read-only).
  • A hidden "Required" description, using the existing @astryx.field.required string, only when the label's marker isn't shown.
  • aria-required on the search box.

No prop, type, visual or interaction change.

Evidence

  • Reproduction before the change: the new test file fails 3 of 5 cases on main (trigger has aria-required; no required text when the form hides the marker; search box without aria-required).
  • Result after the change: all 5 pass; axe's aria-allowed-attr finding on the form wizard template is gone at 390 and 1280 px.
  • Representative unchanged path: without search, the trigger is a combobox and keeps aria-required (tested). Screenshots of the template are byte-identical before and after. All 6 MultiSelector test files pass (276 tests).
  • Regression test: packages/core/src/MultiSelector/MultiSelector.searchRequired.test.tsx.

Scope

Components: MultiSelector; Selector (internal: it now calls the shared rule, no behavior change)

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Writing rubric results

  • R1 narration: the new paragraph states current behavior in the present tense.
  • R2 research: none.
  • R3 evidence: the new verification row names the test file, not a change.
  • R4 rejected alternatives: none.
  • R5 change references: none.
  • R6 open questions: none.
  • R7 project status: none.

Testing

  • vitest --project ui packages/core/src/MultiSelector packages/core/src/Selector (21 files, 630 tests)
  • vitest --project ui packages/core/src/MultiSelector/
  • eslint and prettier on the changed files
  • Chromium with axe: the form wizard template at 390 and 1280 px, before and after

@vercel

vercel Bot commented Nov 16, 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 18, 2026 11:19pm UTC

Request Review

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

astracat-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

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

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · ed8d02d

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC
MultiSelector · Storybook 103.5 kB (+202 B) · 17.8 kB CSS (0) 2,754 (+28)
PowerSearch 310.7 kB (+133 B) · 25.6 kB CSS (0) —
richtext/RichTextEditorToolbar 309.4 kB (+125 B) · 454 B CSS (0) —
45 more components
Component Size LoC
Selector 115.0 kB (+109 B) · 18.7 kB CSS (0) —
Pagination 147.9 kB (+103 B) · 19.1 kB CSS (0) —
richtext/RichTextEditor 308.1 kB (+4 B) · 2.7 kB CSS (0) —
CheckboxListItem 80.4 kB (+1 B) · 12.1 kB CSS (0) —
Field 59.9 kB (+1 B) · 7.3 kB CSS (0) —
RadioList 61.2 kB (+1 B) · 7.4 kB CSS (0) —
Tokenizer 106.0 kB (+1 B) · 20.4 kB CSS (0) —
lab/ListInput 95.3 kB (+1 B) · 922 B CSS (0) —
CheckboxInput 69.5 kB (0) · 10.2 kB CSS (0) —
ComplexSelector 78.9 kB (0) · 12.7 kB CSS (0) —
ContextMenu 103.5 kB (0) · 18.8 kB CSS (0) —
DateInput 203.3 kB (0) · 18.0 kB CSS (0) —
DateTimeInput 226.8 kB (0) · 19.8 kB CSS (0) —
DropdownMenu 108.9 kB (0) · 18.9 kB CSS (0) —
FieldLabel 55.7 kB (0) · 5.8 kB CSS (0) —
FileInput 75.4 kB (0) · 11.7 kB CSS (0) —
InputGroup 61.4 kB (0) · 7.9 kB CSS (0) —
ListItem 79.6 kB (0) · 12.1 kB CSS (0) —
Markdown 205.3 kB (0) · 22.1 kB CSS (0) —
MoreMenu 109.2 kB (0) · 18.9 kB CSS (0) —
NumberInput 104.2 kB (0) · 12.2 kB CSS (0) —
RadioListItem 76.5 kB (0) · 10.7 kB CSS (0) —
SelectorOption 24.2 kB (0) · 6.7 kB CSS (0) —
Slider 115.0 kB (0) · 8.9 kB CSS (0) —
Table 121.7 kB (0) · 19.8 kB CSS (0) —
TableCell 104.7 kB (0) · 19.3 kB CSS (0) —
TableHeaderCell 104.5 kB (0) · 19.1 kB CSS (0) —
TextArea 92.8 kB (0) · 9.4 kB CSS (0) —
TimeInput 178.0 kB (0) · 17.0 kB CSS (0) —
Typeahead 89.3 kB (0) · 13.5 kB CSS (0) —
lab/ChatEmojiPicker 122.8 kB (0) · 773 B CSS (0) —
lab/ChatReactionBar 124.0 kB (0) · 1.1 kB CSS (0) —
lab/CommentComposer 180.6 kB (0) · 1.9 kB CSS (0) —
lab/Comments 379.3 kB (0) · 2.5 kB CSS (0) —
lab/CommentThread 372.3 kB (0) · 2.4 kB CSS (0) —
lab/EmojiPicker 118.9 kB (0) · 751 B CSS (0) —
lab/SelectableCardGroup 69.3 kB (0) · 162 B CSS (0) —
lab/TabBarMoreList 102.5 kB (0) · 1.8 kB CSS (0) —
lab/TransferList 136.5 kB (0) · 1.2 kB CSS (0) —
lab/TransferListSelector 145.4 kB (0) · 1.4 kB CSS (0) —
richtext/RichTextView 285.3 kB (0) · 2.4 kB CSS (0) —
TextInput 99.1 kB (−1 B) · 12.0 kB CSS (0) —
CheckboxList 73.5 kB (−2 B) · 7.8 kB CSS (0) —
DateRangeInput 101.0 kB (−2 B) · 13.3 kB CSS (0) —
Switch 109.6 kB (−4 B) · 10.0 kB CSS (0) —

Package size: @astryxdesign/core 7.68 MB packed (+1.1 kB); no new dependencies.

Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.

Current run: CI concluded cancelled; parts of this report may be missing.


Generated by PR Enrichment workflow | View full report

@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.

Thanks for this fix. The search-mode trigger no longer carries the aria-required that axe flags, and the required state now reaches assistive technology with the list closed and open; a Chromium accessibility-tree check confirms both.

Approval waits on an owner decision and one required fix:

  • Spec decision: no current MultiSelector record states the closed trigger's hidden "Required" description (only Selector's record does, for Selector), so an engineering owner needs to decide whether MultiSelector follows Selector's rule here; an engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner.
  • Required fix: the required-with-search logic in MultiSelector.tsx (lines 2527-2538, 2543-2553 and 2726-2730) copies Selector.tsx instead of sharing it, so move that decision into the module both selectors already call for optionality (hooks/useResolvedRequired.ts), use it from Selector and MultiSelector, and delete both copies.

A small comment-style suggestion is inline.

Claims and files checked

Review mode: full; reason: no-earlier-review

Claims:

  • Changeset: the search trigger no longer carries aria-required: verified (MultiSelector.tsx:2552-2553; Chromium tree).
  • Changeset: a required field still says so through the label marker in the trigger's name or a hidden "Required" description: verified (MultiSelector.tsx:2532-2538, :2726-2730; new test cases 2 and 3; Chromium tree).
  • Changeset: the search box carries aria-required while the list is open: verified (MultiSelector.tsx:2039; new test case 4; Chromium tree).
  • Changeset and body: this matches Selector: verified (Selector.tsx:2147-2157, :2264-2276, :2371-2375).
  • Body: on main a required searchable trigger puts aria-required on a plain button: verified (new test case 1 fails on main).
  • Body: ARIA does not allow aria-required on a button and axe reports aria-allowed-attr: verified (axe in Chromium fails on main, passes here).
  • Body: a form template uses a required searchable MultiSelector: verified (form-wizard-dialog, form-wizard-vertical); axe was not rerun on the templates themselves.
  • Body: Selector's spec describes this behavior for its search mode: verified (Selector spec, accessibility contract).
  • Body: MultiSelector shares the input-field contract and should behave the same: not established; no current MultiSelector record states it (the owner decision above).
  • Body: without search, or read-only, the trigger is a combobox and keeps aria-required: verified (MultiSelector.tsx:2531, :2739; new test case 5).
  • Body: the hidden description reuses the existing required string only when the marker is not shown: verified (@astryx.field.required; MultiSelector.tsx:2537-2538).
  • Body: no prop, type, visual or interaction change: verified (built API surface unchanged; the added text is visually hidden).
  • Body: the new test fails 3 of 5 cases on main and passes all 5 after: verified (rerun).
  • Body: all 6 MultiSelector test files pass (276 tests): verified (rerun).
  • Body: template screenshots are byte-identical and the axe finding is gone at 390 and 1280 px: not rerun on the template; the same axe rule passes here on a fixture with the same props.
  • Body: eslint and prettier on the changed files: the Lint workflow passed on this head.

Files:

  • .changeset/multiselector-search-required.md: clear.
  • packages/core/src/MultiSelector/MultiSelector.searchRequired.test.tsx: clear.
  • packages/core/src/MultiSelector/MultiSelector.tsx: required fix (logic copied from Selector); non-blocking comment-style suggestion.

Automated review (maintainer link)

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 16, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 5d1ad3d

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 16, 2026

@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.

Thanks for moving the rule into one hook: both selectors now share it, the search trigger no longer carries the aria-required that axe flags, and the required state reaches the accessibility tree with the list closed and open. The MultiSelector record change is approved for this head, which settles the earlier spec question.

One change is needed before approval:

  • packages/core/src/Selector/useSearchTriggerRequired.tsx is a new internal module that MultiSelector imports but no spec record names, so either move the rule into useResolvedOptionality in hooks/useResolvedRequired.ts, which both selectors already call, or name the module in a record (its usage, why it is needed, and why the existing hook is not enough) and have an engineering owner approve that head.
Claims and files checked

Review mode: full; reason: spec-record

Claims:

  • Title and changeset: the search trigger no longer carries aria-required: verified (useSearchTriggerRequired.tsx:63; the new test's first case fails on the base; Chromium accessibility tree).
  • Changeset: a required field still says so, through the label marker in the trigger's name or a hidden "Required" description: verified (useSearchTriggerRequired.tsx:56-67; test cases 2 and 3; Chromium tree under a required form default, a caller aria-label and an InputGroup).
  • Changeset: the search box carries aria-required while the list is open: verified (MultiSelector.tsx:2050; test case 4; Chromium tree).
  • Changeset and description: this matches Selector: verified (Selector calls the same hook, Selector.tsx:1271-1281).
  • Description: on the base a required searchable trigger puts aria-required on a plain button, which axe flags as aria-allowed-attr: verified (red-first test; axe in Chromium fails on the base, passes here).
  • Description: a form template uses a required searchable MultiSelector: verified (form-wizard-dialog, form-wizard-vertical).
  • Description: the shared hook returns the trigger's aria-required, the description id and the description, and both selectors call it: verified (useSearchTriggerRequired.tsx:62-67; Selector.tsx:1271; MultiSelector.tsx:1225).
  • Description: Selector's behavior is unchanged and its tests pass: verified (same logic; Selector's search-required and main test files pass).
  • Description: MultiSelector's record gains one paragraph and one verification row: verified (MultiSelector.spec.md:196-202, :344).
  • Description: Selector's record describes this behavior for its search mode, and MultiSelector should behave the same: verified (Selector's accessibility contract; the MultiSelector paragraph is approved for this head).
  • Description: without search, or read-only, the trigger is a combobox and keeps aria-required: verified (useSearchTriggerRequired.tsx:63; MultiSelector.tsx:2729; test case 5).
  • Description: the description reuses the existing required string: verified (@astryx.field.required in the English catalog).
  • Description: no prop, type, visual or interaction change: verified (built API surfaces identical; base and head frames pixel-identical).
  • Description: the new test fails 3 of 5 cases on the base and passes all 5 after: verified (rerun).
  • Description: the six MultiSelector test files pass (276 tests), and 21 files (630 tests) across both selectors: verified (rerun).
  • Description: the axe finding is gone on the form wizard template at 390 and 1280 px, with identical screenshots: not rerun on the template; the same axe rule passes here on stories with the same props, whose frames are pixel-identical.
  • Description: eslint and prettier on the changed files: the Lint workflow passed on this head.

Files:

  • .changeset/multiselector-search-required.md: clear.
  • docs/specs/components/MultiSelector/MultiSelector.spec.md: clear (approved for this head).
  • packages/core/src/MultiSelector/MultiSelector.searchRequired.test.tsx: clear.
  • packages/core/src/MultiSelector/MultiSelector.tsx: clear.
  • packages/core/src/Selector/Selector.tsx: clear.
  • packages/core/src/Selector/useSearchTriggerRequired.tsx: blocking (a new internal module no record names).

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec d33cc71

@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 pending CI: CI has not run on this head yet, because the run was refused for capacity, so please re-run all jobs before merging.

Moving the rule into hooks/useResolvedRequired.ts resolves the earlier request: both selectors now call one function, and the new module is gone. The search trigger no longer carries the aria-required that axe flags, and the required state reaches the accessibility tree with the list closed and open in every labelling case. The MultiSelector record change is approved for this head.

  • Non-blocking: the reference-page size rule asks a pull request that grows a shared module to state its first-load gzip delta; measured here, docs +0 B, form +2 B, menu +0 B and table +0 B, so one line in the description covers it.
Claims and files checked

Review mode: incremental; reason: none

Claims:

  • Title: the search trigger no longer carries aria-required: verified (new test, and the Chromium accessibility tree at both revisions).
  • Changeset: the trigger button drops aria-required; the label marker or a hidden "Required" description states the required state; the search box is required while open; this matches Selector: verified (MultiSelector.tsx:2042, :2552, :2725-2729; useResolvedRequired.ts:131-140; both selectors' search-required tests pass).
  • A form template with a required, searchable MultiSelector shows the axe error: verified (the dialog and vertical form-wizard templates render one; axe fails on the base for that field and passes on the head).
  • ARIA does not allow aria-required on a button: verified (axe aria-allowed-attr).
  • The shared rule is one function beside the existing optionality hook, and each component renders the description: verified (useResolvedRequired.ts:112-141, Selector.tsx:2150, MultiSelector.tsx:2530).
  • Selector's behavior is unchanged and its tests pass: verified (the removed expressions match the function line for line; 15 Selector files pass).
  • The record gains one paragraph and one verification row: verified (MultiSelector.spec.md:196-202, :344).
  • No prop, type, visual or interaction change: verified (no public API row in Core or the themes; captured frames are pixel-identical).
  • The new test fails 3 of 5 cases on the base and passes 5 of 5 on the head: verified.
  • Without search the trigger stays a combobox with aria-required: verified (test and accessibility tree).
  • All six MultiSelector test files pass (276 tests); the Selector and MultiSelector folders pass (21 files, 630 tests): verified.
  • ESLint and Prettier pass on the changed files: verified.
  • Axe passes on the form-wizard template at 390 and 1280 px and its screenshots are unchanged: verified on the same field states (axe passes, frames pixel-identical); the template page itself was not re-run.

Files:

  • .changeset/multiselector-search-required.md: clear.
  • docs/specs/components/MultiSelector/MultiSelector.spec.md: clear.
  • packages/core/src/MultiSelector/MultiSelector.searchRequired.test.tsx: clear.
  • packages/core/src/MultiSelector/MultiSelector.tsx: clear.
  • packages/core/src/Selector/Selector.tsx: clear.
  • packages/core/src/hooks/useResolvedRequired.ts: clear.

Automated review (maintainer link)

@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 pending CI: CI has not run on this head yet, because the run was refused for capacity, so please re-run all jobs before merging.

After the rebase, the search trigger still drops the aria-required that axe flags, the required state reaches the accessibility tree with the list closed and open in every labelling case, and both selectors share one rule. The MultiSelector record change is approved for this head.

  • Non-blocking: the reference-page size rule asks a pull request that grows a shared module to state its first-load gzip delta; measured here, docs +0 B, form +0 B, menu +0 B and table −3 B, so one line in the description covers it.
Claims and files checked

Review mode: full; reason: rebase

Claims:

  • Title: the search trigger no longer carries aria-required: verified (the new test, and Chromium's accessibility tree at both revisions).
  • Changeset: the trigger button drops aria-required, the label marker or a hidden "Required" description states the required state, the search box is required while open, and this matches Selector: verified (MultiSelector.tsx:2049, :2559, :2732-2736; useResolvedRequired.ts:131-140; both selectors' search-required tests pass).
  • ARIA does not allow aria-required on a button, checkers flag it, and assistive technology may ignore it: verified (axe aria-allowed-attr on the base trigger; Chromium's tree gives the base button no required state).
  • A form template with a required, searchable MultiSelector shows the error: verified for that field configuration (form-wizard-dialog/page.tsx:477, form-wizard-vertical/page.tsx:1052); the template page itself was not rendered.
  • The fix copies Selector's behavior, and Selector's own record describes it for search mode: verified (Selector AR1; the function equals the removed Selector expressions).
  • The shared rule is one function beside the existing optionality hook, and each component renders the description: verified (useResolvedRequired.ts:112-141, Selector.tsx:2382, MultiSelector.tsx:2732).
  • Selector's behavior is unchanged and its tests pass: verified (the Selector folder passes, Selector.searchRequired.test.tsx 5 of 5).
  • The record gains one paragraph and one verification row: verified (MultiSelector.spec.md:196-202, :344).
  • Smallest restoration (trigger keeps aria-required only as a combobox; hidden description only when the marker is not shown; aria-required on the search box): verified (useResolvedRequired.ts:131-139, MultiSelector.tsx:2049).
  • No prop, type, visual or interaction change: verified (no public API row in Core or the themes; captured frames are pixel-identical).
  • The new test fails 3 of 5 cases on the base and passes 5 of 5 on the head: verified.
  • Without search the trigger stays a combobox with aria-required: verified (test and accessibility tree).
  • Axe passes on the form wizard template at 390 and 1280 px, and its screenshots are unchanged: verified for the same field states at 1280 px (axe passes, frames pixel-identical); the template page and the 390 px width were not re-run.
  • All six MultiSelector test files pass (276 tests), and the Selector and MultiSelector folders pass (21 files, 630 tests): verified that all pass; after the rebase they hold 284 tests, and 22 files with 658 tests.
  • ESLint and Prettier pass on the changed files: verified (the Lint workflow passes on this head).

Files:

  • .changeset/multiselector-search-required.md: clear.
  • docs/specs/components/MultiSelector/MultiSelector.spec.md: clear (owner-approved for this head).
  • packages/core/src/MultiSelector/MultiSelector.searchRequired.test.tsx: clear.
  • packages/core/src/MultiSelector/MultiSelector.tsx: clear.
  • packages/core/src/Selector/Selector.tsx: clear.
  • packages/core/src/hooks/useResolvedRequired.ts: non-blocking note (the description does not state the reference-page gzip deltas for this shared module).

Automated review (maintainer link)

josephfarina added a commit that referenced this pull request Nov 19, 2026
- #12618 fix(cli): search's text icons label + icon-ask wording
  Author: @josephfarina
- #12688 docs(cli): experimental icon sets — explain the icon model in one place
  Author: @josephfarina
- #12123 fix(core): MultiSelector search trigger no longer carries aria-required
  Author: @josephfarina
@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed in #12844.

@github-actions
github-actions Bot deleted the josephfarina/multiselector-search-required branch November 20, 2026 06:06

This branch was successfully deployed

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

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant