Skip to content

fix(CheckboxInput): a required box is not announced as invalid before an error - #11619

Merged
cixzhang merged 1 commit into
mainfrom
lane4/checkbox-required-not-invalid
Nov 14, 2026
Merged

cixzhang merged 1 commit into
mainfrom
lane4/checkbox-required-not-invalid

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

User impact

A screen reader in Chromium said "invalid entry" on every required CheckboxInput of a fresh form, before the person had touched it or submitted anything. Nothing on screen looked invalid. Now a required checkbox is announced as invalid only when its status is an error, as a required Switch already is. Native validation still stops a form from submitting with the box unchecked.

Problem and solution fit

  1. Why it occurs. The input sets native required and leaves aria-invalid unset unless status is an error. Chromium then takes the accessible invalid state from native constraint validation, so an unchecked required box is exposed as invalid from its first render.
  2. Fix. aria-invalid is true with an error status, false on a required box without one, and unset otherwise, the same as Switch.

Expected behavior and authority

  • component:Switch FR8 (current): "aria-invalid follows status (false on a required switch without an error), so the browser's own invalid state never shows before an error."
  • component:CheckboxInput FR7 now states the same rule for a checkbox; FR6 (an error status exposes invalid) and native required validation are unchanged.
  • component:CheckboxList: its required-group note kept a comparison with CheckboxInput's old behavior. The comparison is removed. CheckboxList's own behavior is unchanged: while a required group is empty, its first box still reports that state.

Smallest restoration

  • packages/core/src/CheckboxInput/CheckboxInput.tsx: the aria-invalid expression.
  • docs/specs/components/CheckboxInput/CheckboxInput.spec.md: one FR7 sentence and its verification row.
  • docs/specs/components/CheckboxList/CheckboxList.spec.md: one clause removed from the required-group note.
  • The checkbox accessibility state input-required now expects no invalid state.
  • A [fix] changeset for @astryxdesign/core.

Evidence

  • CheckboxInput.test.tsx "required invalid state": a required box has aria-invalid="false", is still required, and its form fails validation; with an error status it has aria-invalid="true"; a box that is not required has no aria-invalid. The first case fails on main and passes here.
  • Checkbox.a11y.chromium.spec.ts checks the input-required story's real Chromium accessibility tree, which now expects invalid: false.
  • The CheckboxInput, CheckboxList, FormLayout and Switch suites pass (11 files, 368 tests), with no type errors, eslint clean and the knowledge check aligned.

Scope

  • 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: none; the FR7 sentence states the behavior in the present tense.
  • R2 research in the record: none.
  • R3 one fact per sentence: yes.

Testing

  • pnpm exec vitest run packages/core/src/CheckboxInput packages/core/src/CheckboxList packages/core/src/FormLayout packages/core/src/Switch: 11 files, 368 tests pass.
  • tsc --noEmit for @astryxdesign/core: clean. pnpm check:knowledge: aligned.

Fixes #11571. Thanks to @duytbp for the precise report.

Owner: fix-loop lane 4. Land path: Drain merges after CodeBunny, Specs and CI, including the accessibility leg.

… an error

Chromium exposes an unchecked native-required checkbox as invalid from
its first render. The invalid state now follows status, false on a
required box without an error, as on Switch. Native required still
blocks submission. CheckboxInput FR7 states the rule; CheckboxList's
required note no longer compares itself to CheckboxInput.

Fixes #11571
@vercel

vercel Bot commented Nov 13, 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 13, 2026 10:30pm UTC

Request Review

@cixzhang cixzhang added the ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) label Nov 13, 2026
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 13, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 13, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 3a9f42f

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

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 3a9f42f

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
lab/Comments 367.3 kB (+7 B) · 2.5 kB CSS (0) — — · — · —
ListItem 74.8 kB (+6 B) · 11.7 kB CSS (0) — — · — · —
MultiSelector 101.2 kB (+6 B) · 17.7 kB CSS (0) — — · — · —
16 more components
Component Size LoC Visual · A11y · RTL
lab/CommentThread 360.5 kB (+6 B) · 2.4 kB CSS (0) — — · — · —
lab/TabBarMoreList 97.5 kB (+6 B) · 1.8 kB CSS (0) — — · — · —
CheckboxInput · Storybook 68.8 kB (+5 B) · 10.1 kB CSS (0) 424 (+2) ✓ · ✓ · ✓
CheckboxListItem 75.7 kB (+5 B) · 11.7 kB CSS (0) — — · — · —
ContextMenu 117.5 kB (+5 B) · 18.3 kB CSS (0) — — · — · —
Table 135.6 kB (+5 B) · 19.2 kB CSS (0) — — · — · —
TableHeaderCell 118.3 kB (+5 B) · 18.6 kB CSS (0) — — · — · —
Markdown 198.5 kB (+4 B) · 21.5 kB CSS (0) — — · — · —
TableCell 118.8 kB (+4 B) · 18.8 kB CSS (0) — — · — · —
lab/TransferList 107.6 kB (+4 B) · 1.2 kB CSS (0) — — · — · —
lab/TransferListSelector 116.5 kB (+4 B) · 1.4 kB CSS (0) — — · — · —
richtext/RichTextEditor 305.3 kB (+4 B) · 2.6 kB CSS (0) — — · — · —
richtext/RichTextView 281.9 kB (+3 B) · 2.3 kB CSS (0) — — · — · —
PowerSearch 306.1 kB (+1 B) · 25.3 kB CSS (0) — — · — · —
MoreMenu 104.4 kB (0) · 18.5 kB CSS (0) — — · — · —
DropdownMenu 104.2 kB (−1 B) · 18.5 kB CSS (0) — — · — · —

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

Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.


Generated by PR Enrichment workflow | View full report

@astracat-bot

astracat-bot Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

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

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

A required CheckboxInput without an error status now renders aria-invalid="false", so Chromium no longer reports it invalid before anything is wrong, while an error status still exposes invalid and native required still blocks an unchecked submit. The new unit test fails on main and passes here, and Chromium's accessibility tree for the required story changes from invalid to not invalid with no visual change. The FR7 sentence is approved for this head, and a required CheckboxList keeps reporting its first box while the group is empty, as its record says.

Claims and files checked
  • Verified: a required box is no longer reported invalid before it is touched (the aria-invalid expression, the new test, and the head's accessibility tree).
  • Verified: on main, Chromium reports an unchecked required box invalid from its first render.
  • Verified: the invalid state follows status exactly as on Switch.
  • Verified: native validation still blocks an unchecked submit (the test's checkValidity() assertion).
  • Verified: CheckboxList's behavior is unchanged, since its items pass no isRequired and its first box still reports the empty group.
  • Verified: the input-required accessibility state now expects no invalid state.
  • Verified: the CheckboxInput, CheckboxList, FormLayout and Switch suites pass (11 files, 368 tests), the Core typecheck is clean, eslint reports no errors, and the knowledge and changeset checks pass.
  • Verified: no public API changes.
  • .changeset/checkbox-required-not-invalid.md: clear
  • docs/specs/components/CheckboxInput/CheckboxInput.spec.md: clear
  • docs/specs/components/CheckboxList/CheckboxList.spec.md: clear
  • packages/core/src/CheckboxInput/CheckboxInput.test.tsx: clear
  • packages/core/src/CheckboxInput/CheckboxInput.tsx: clear
  • packages/core/src/CheckboxInput/__tests__/Checkbox.a11y.states.ts: clear

Automated review (maintainer link)

This branch was successfully deployed

1 active deployment
Preview — 3a9f42f2 Deployed Nov 13, 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-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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] CheckboxInput: a required box is announced as invalid before the user touches it

1 participant