Skip to content

[Component Audit] ComplexSelector: the trigger is a combobox field on both paths - #6991

Merged
cixzhang merged 5 commits into
mainfrom
night-watch-component-audit/ComplexSelector/2026-10-06
Oct 24, 2026
Merged

cixzhang merged 5 commits into
mainfrom
night-watch-component-audit/ComplexSelector/2026-10-06

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

User impact

A screen-reader user filling in a required ComplexSelector was never told it was required: the trigger was a button, and browsers drop aria-required on a button. A disabled trigger rendered through renderTrigger was also not announced as unavailable. After this change the trigger is a combobox whose popup is a dialog, on both the built-in and caller-rendered paths, so required, invalid, busy, and disabled state reach assistive technology wherever the popup opens from.

What changed

  • Runtime. The built-in trigger gets role="combobox" (it keeps aria-haspopup="dialog", aria-expanded, aria-controls). With renderTrigger, the handed-back props add role: 'combobox', aria-required, aria-disabled, and an aria-label from label unless the selector is given aria-label or aria-labelledby: a combobox takes no name from its content. A disabled caller control keeps its tab stop and no press or key opens it or reaches a handler (spec:AST-085). Button keeps a caller-supplied aria-disabled and aria-busy, so an Astryx Button or IconButton used as the control (the prop's own example) carries the selector's disabled and busy state instead of overwriting it.
  • Record. component:ComplexSelector is rebased onto main (secondary variant, container*/control* part styling, aria-disabled with a kept tab stop, BaseProps on the caller control) and records DEC-1: the trigger is a combobox field on both paths. Invalid state reaches the built-in trigger only, where the status message renders (FR7, AR6).
  • Evidence. The audit matrix story, the Chromium audit spec, the RTL target, and the audit CI step from the original audit are kept and now expect the combobox role. The two retained gaps are closed.
  • Tests. Queries that found the trigger as a button now find a combobox (ComplexSelector, TransferListSelector composition, disabled-trigger focus spec). New tests cover the built-in required combobox and the caller control's role, required, and disabled state.

API

  • ComplexSelectorRenderTriggerProps gains role, aria-label, aria-required, and aria-disabled.
  • Breaking for test code only: getByRole('button') on the trigger becomes getByRole('combobox'). The changeset says so.

Authority

  • component:ComplexSelector DEC-1 (decider cixzhang, 2026-10-24)
  • spec:AST-085 FR1, FR2, FR4; spec:AST-055 FR1–FR7; family:input-fields FR10

Writing rubric results

  • R1 narration: one "now" in Compatibility/readiness; rewritten as a present-tense statement.
  • R2 research: none in the record; audit scores and receipts stay in CI artifacts.
  • R3 evidence: bases cite current source, tests, specs, and WCAG; no pull request or commit.
  • R4 rejected alternatives: one, in DEC-1, one line (a disclosure button with a narrowed API).
  • R5 change references: none.
  • R6 open questions: OQ1 is answered by DEC-1 and removed; Open questions reads "None."

Testing

  • vitest run packages/core/src/ComplexSelector packages/lab/src/TransferList packages/core/src/__tests__/BusyOwnerAnnouncement.test.tsx: 208/208 passed; packages/core/src/Button packages/core/src/IconButton packages/core/src/ComplexSelector: 200/200 passed
  • pnpm check:knowledge: aligned
  • Pre-commit hook (lint-staged and repository checks): passed
  • Chromium audit evidence and the disabled-trigger focus spec run in CI on this head

@vercel

vercel Bot commented Oct 6, 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 Oct 24, 2026 7:47pm UTC

Request Review

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

astracat-bot Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 24, 2026, 8:24 PM UTC

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Previews ready: Storybook and Sandbox were built with this PR's docsite. CI evidence will be added when available.

View Storybook for this PR · View Sandbox for this PR

@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 a careful, evidence-first audit — the rendered state matrix and the decision to record the two trigger gaps honestly, rather than baselining or quietly fixing them, make this easy to trust.

One maintainer decision is needed before approval: which public semantic contract should the trigger use in both modes — a combobox-like field control that can validly expose required/disabled state and preserve accepted BaseProps, or a disclosure button whose API is narrowed to only the states and inputs that role can honor? Approval waits on a maintainer providing or identifying the governing spec for that contract.

The two findings that follow from the decision are already well recorded in the change:

  • The built-in trigger emits a required attribute its button role does not support, which fails the accessibility audit critically.
  • Caller-rendered mode does not project disabled state or inherited BaseProps onto the caller control, so accepted inputs silently stop working in that mode.

No runtime change is requested until the contract is chosen; once it is, those two items become the required follow-through. Everything else — the contract record, the Chromium evidence, and the fail-closed CI wiring — reads as ready.

[Automated review]

Rebased onto main. The record now describes main's behavior (secondary
variant, field part styling props, aria-disabled with a kept tab stop,
BaseProps on the caller control) and records DEC-1: the trigger plays the
combobox role with a dialog popup on both paths, so aria-required is valid
and a caller-rendered control carries required and disabled state.

The audit matrix, Chromium evidence, and CI step from the original audit
are kept; tests that found the trigger as a button now find a combobox.
@cixzhang
cixzhang force-pushed the night-watch-component-audit/ComplexSelector/2026-10-06 branch from 1e46355 to e70405a Compare October 24, 2026 17:17
@cixzhang cixzhang changed the title [Component Audit] ComplexSelector: make custom-trigger evidence trustworthy [Component Audit] ComplexSelector: the trigger is a combobox field on both paths Oct 24, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec e70405a

@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: the combobox trigger fixes the missing required-state announcement, and the owner decision is recorded for this head. Two follow-ups are needed before merge:

  • An Astryx Button or IconButton used as the renderTrigger control, which is the prop's own example, overwrites the handed-back aria-disabled and aria-busy, so a disabled selector is announced as enabled; letting Button keep a supplied value, with a test, would fix it.
  • AR6 says invalid state is heard on both paths, but the caller-rendered control never receives aria-invalid; narrow AR6 to the built-in trigger, as FR7 already does, or hand back aria-invalid for an error status.

[Automated review]

'aria-controls': contentId,
'aria-busy': isBusy || undefined,
'aria-required': isEffectivelyRequired ? 'true' : undefined,
'aria-disabled': isDisabled ? 'true' : undefined,

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.

With an Astryx Button or IconButton as the control (the JSDoc example and the audit-matrix story), this value never reaches the DOM. Button.tsx spreads its props and then writes aria-disabled={useAriaDisabled || undefined} and aria-busy={isLoadingState || undefined}, so a disabled selector is exposed as an enabled combobox while presses do nothing. Letting Button keep a supplied aria-disabled and aria-busy, plus a disabled case with a Button control in the trigger-semantics suite, would close this.

- **AR3 — Focus lifecycle.** The popup autofocuses its content through the Popover owner, and every supported close route returns focus to the current trigger before `onOpenChange(false)` runs.
- **AR4 — Content responsibility.** Caller content supplies the role, name, keyboard model, selected state, and focus navigation appropriate to its own selection pattern.
- **AR5 — Direction and viewport.** Logical placement and alignment mirror with inherited direction, and the scrollable popup content remains reachable at 320 CSS px.
- **AR6 — One trigger role.** Both paths expose the same combobox role and state, so a person hears required, invalid, busy, and disabled state whichever control opens the popup.

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.

The handed-back props carry no aria-invalid, and status is not rendered with renderTrigger, so a caller-rendered control is announced as valid. FR7 and the validation row already limit invalid state to the built-in trigger. Either narrow AR6 to match, or hand back aria-invalid for an error status.

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 02d8551

@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: making the trigger a combobox fixes the missing required-state announcement, and the owner decision is recorded for this revision. Three follow-ups are needed before merge:

  • An Astryx Button or IconButton used as the renderTrigger control, which is the prop's own example, overwrites the handed-back aria-disabled and aria-busy, so a disabled selector is announced as enabled; letting Button keep a supplied value, with a test, would fix it.
  • AR6 says invalid state is heard on both paths, but the caller-rendered control never receives aria-invalid; narrow AR6 to the built-in trigger, as FR7 already does, or hand back aria-invalid for an error status.
  • The new Chromium audit spec reads the focus ring and the chevron from the trigger button, but both live on the control box, so its built-in focus test fails; point that locator at the .astryx-complex-selector box.

[Automated review]

for (const baseScenario of BUILTIN_INTERACTION_CASES) {
const {errors} = await loadScenario(page, baseScenario);
const trigger = page.getByRole('combobox', {name: 'Selected medium'});
const owner = page.locator('[data-testid="rtl-trigger"]');

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.

[data-testid="rtl-trigger"] is the trigger <button> (data-testid reaches it through rest), but the field's keyboard ring is painted on the control box (focusOutlineStyles.focusWithin) and the button keeps outline: none. Replaying these steps in Chromium, the button is focused and matches :focus-visible yet reports outline-style: none and box-shadow: none, so the assertion at lines 676–678 fails, and owner.locator('svg') at 730–731 finds no chevron inside the button. Reading the paint and the indicator from the control box, for example page.locator('.astryx-complex-selector').filter({has: page.locator('[data-testid="rtl-trigger"]')}), would fix both.

… Button trigger carries the selector's state; narrow AR6 invalid state to the built-in trigger
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec bcc2f65

@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: the trigger is now a combobox that carries required, disabled and busy state on both the built-in and renderTrigger paths, and the earlier Button, AR6 and audit-spec follow-ups are fixed. One change is needed before merge: the record's Contract at a glance still says "No API changes" in its Public contract row and names no migration in Builder impact (packages/core/src/ComplexSelector/ComplexSelector.spec.md:42, :45). Please state the four new ComplexSelectorRenderTriggerProps members and the combobox role there, and name the move from getByRole('button') to getByRole('combobox') that the Changeset already describes.

[Automated review]

Comment on lines +42 to +45
| Public contract | No API changes in this observational record. Current source exports one controlled rich-selector shell, its public props and supporting types, an imperative handle, a content render function, an optional `renderTrigger` seam governed by `spec:AST-055`, and named `container*`/`control*` styling targets in place of root styling props. |
| Behavior | The built-in path composes Field, one combobox trigger whose popup is a dialog, an indicator, and a mounted dialog popup. The caller-rendered path replaces the Field and built-in trigger chrome with one unwrapped caller control that carries the same combobox role and state, while ComplexSelector keeps anchoring, open state, popup wiring, focus return, and the popup. |
| End-user impact | People selecting through rich custom content receive one named combobox trigger that announces required, busy, and disabled state (and invalid state on the built-in trigger), keyboard and pointer opening, focus restoration, and a popup that remains reachable across logical placement and viewport direction. |
| Builder impact | Builders provide controlled value plus custom dialog content. They may use the built-in field trigger, call the imperative handle, or spread one exported trigger-props object onto a caller-rendered control, which then becomes the selector's combobox field. |

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.

This projection still reads "No API changes in this observational record", and Builder impact names no migration, while FR10/AR2 and the code add role, aria-label, aria-required and aria-disabled to ComplexSelectorRenderTriggerProps and make the trigger a combobox on both paths. The knowledge-contracts projection asks this row to state the exact public delta and Builder impact to name migration work, so stating the four members and the combobox role here, and the getByRole('button') to getByRole('combobox') move in Builder impact, would close it.

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec dde9075

@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: the trigger is now a combobox that carries required, disabled and busy state on both the built-in and renderTrigger paths, the owner decision is recorded for this revision, and the earlier follow-ups (Button state, AR6, the audit locator and the contract projection) are all addressed. This looks ready to merge. One optional polish: the record's Builder impact row could also say that a renderTrigger control is now named by label, so a test that finds such a control by its visible text needs the new name as well as the new role.

[Automated review]

| Public contract | The trigger plays the combobox role on both paths (DEC-1), and `ComplexSelectorRenderTriggerProps` carries `role`, `aria-label`, `aria-required`, and `aria-disabled` beside its existing ref, id, handlers, and popup props. Current source exports one controlled rich-selector shell, its public props and supporting types, an imperative handle, a content render function, an optional `renderTrigger` seam governed by `spec:AST-055`, and named `container*`/`control*` styling targets in place of root styling props. |
| Behavior | The built-in path composes Field, one combobox trigger whose popup is a dialog, an indicator, and a mounted dialog popup. The caller-rendered path replaces the Field and built-in trigger chrome with one unwrapped caller control that carries the same combobox role and state, while ComplexSelector keeps anchoring, open state, popup wiring, focus return, and the popup. |
| End-user impact | People selecting through rich custom content receive one named combobox trigger that announces required, busy, and disabled state (and invalid state on the built-in trigger), keyboard and pointer opening, focus restoration, and a popup that remains reachable across logical placement and viewport direction. |
| Builder impact | Builders provide controlled value plus custom dialog content. They may use the built-in field trigger, call the imperative handle, or spread one exported trigger-props object onto a caller-rendered control, which then becomes the selector's combobox field. Test code that finds the trigger with `getByRole('button')` uses `getByRole('combobox')`. |

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.

Optional: a renderTrigger control is now named by label (AR2), so a test that finds a text-labelled control by its text needs the new name as well as the new role, as ComplexSelector.test.tsx:518 did. Saying so here would complete the migration line.

@cixzhang
cixzhang merged commit e52ef25 into main Oct 24, 2026
65 of 66 checks passed
@github-actions
github-actions Bot deleted the night-watch-component-audit/ComplexSelector/2026-10-06 branch October 25, 2026 06:20

This branch was successfully deployed

1 active deployment
Preview — dde90755 Deployed Oct 24, 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