Repository navigation
fix(CheckboxInput): a required box is not announced as invalid before an error - #11619
Conversation
… 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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
/approve-spec 3a9f42f |
PR Analysis Report🔎 Preview ·
|
| 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
|
AI review status for this pull request.
|
There was a problem hiding this comment.
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-invalidexpression, 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
statusexactly as onSwitch. - Verified: native validation still blocks an unchecked submit (the test's
checkValidity()assertion). - Verified: CheckboxList's behavior is unchanged, since its items pass no
isRequiredand its first box still reports the empty group. - Verified: the
input-requiredaccessibility 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: cleardocs/specs/components/CheckboxInput/CheckboxInput.spec.md: cleardocs/specs/components/CheckboxList/CheckboxList.spec.md: clearpackages/core/src/CheckboxInput/CheckboxInput.test.tsx: clearpackages/core/src/CheckboxInput/CheckboxInput.tsx: clearpackages/core/src/CheckboxInput/__tests__/Checkbox.a11y.states.ts: clear
User impact
A screen reader in Chromium said "invalid entry" on every required
CheckboxInputof 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 itsstatusis an error, as a requiredSwitchalready is. Native validation still stops a form from submitting with the box unchecked.Problem and solution fit
requiredand leavesaria-invalidunset unlessstatusis 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.aria-invalidistruewith an error status,falseon a required box without one, and unset otherwise, the same asSwitch.Expected behavior and authority
component:SwitchFR8 (current): "aria-invalidfollowsstatus(falseon a required switch without an error), so the browser's own invalid state never shows before an error."component:CheckboxInputFR7 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 withCheckboxInput'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: thearia-invalidexpression.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.input-requirednow expects no invalid state.[fix]changeset for@astryxdesign/core.Evidence
CheckboxInput.test.tsx"required invalid state": a required box hasaria-invalid="false", is still required, and its form fails validation; with an error status it hasaria-invalid="true"; a box that is not required has noaria-invalid. The first case fails onmainand passes here.Checkbox.a11y.chromium.spec.tschecks theinput-requiredstory's real Chromium accessibility tree, which now expectsinvalid: false.Scope
Writing rubric results
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 --noEmitfor@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.