Repository navigation
fix(TextInput): keep a caller aria-labelledby on the input - #8707
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.
This restores a caller's aria-labelledby on TextInput, as component:TextInput FR13 and family:input-fields FR10.1 require. The new tests fail without the fix, Chromium's accessibility tree shows the expected names, and no defects were found. Approval waits on one spec decision: the new FR13/AR1 sentence that a caller aria-labelledby follows the field's own label sets an order the current TextInput spec does not state. An engineering owner records that decision by commenting /approve-spec 6f26417760fdfca5ff0a83cb1a87af108f2effbb on this pull request (the author may do so if they are an engineering owner); if they choose another order, the code, tests, spec sentences and changeset change with it.
[Automated review]
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewModified ComponentsTextInput (@astryxdesign/core) · View in Storybook
Component Size
Sizes are gzip. Import counts the JavaScript the import loads eagerly; CSS counts the package stylesheet rules referenced by the modules it can load from its own package, lazily loaded ones included. Bundle Size SummaryGzip figures measure each package's entry file, not the code an import pulls in.
Accessibility AuditStatus: No accessibility violations detected. Visual RegressionStatus: No visual change across 4 compared shot(s). Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
|
/approve-spec 6f26417 |
There was a problem hiding this comment.
No changes needed: this restores a caller's aria-labelledby on TextInput as component:TextInput FR13 and family:input-fields FR10.1 require, and the label-first order it adds to FR13 and AR1 has an engineering owner's /approve-spec for this head. The new standalone and grouped tests fail without the fix and pass with it, and Chromium's accessibility tree names the fields “Email Billing” and “Contact Email Billing”, as the changeset says. Merging still needs the repository's regular code review.
[Automated review]
…ller aria-labelledby (#8862) Follow-up to #8707, #8708, #8710 and #8711 (the #8706 family): the same bug on the Field-composed controls #8706 did not list. TextArea, Typeahead and Tokenizer spread a caller's `aria-*` onto the control, so a caller's `aria-labelledby` becomes the control's only name and the field's own label is dropped. Probe on current main: - `<TextArea label="Notes" aria-labelledby="b" />` has `aria-labelledby="b"`, so it is named "Billing", not "Notes Billing". - `<Typeahead label="Fruit" aria-labelledby="b" />` is the same, and inside an `InputGroup` the group's label id is also lost. - `<Tokenizer label="Members" aria-labelledby="b" />` is the same, for both the inline input and the compact trigger. Fix, following #8707: destructure the caller's `aria-labelledby`, give the Field a `labelID`, and join the field's label id (or, in a group, the group and input label ids) with the caller's ids using `joinAriaIDs`. Controls without a caller `aria-labelledby` are unchanged. Spec: `family:input-fields` FR10.1 ("`aria-*` ... MUST reach the primary semantic control"). Tests: one per component, plus a grouped Typeahead case. The four new tests fail without the change. TextArea, Typeahead and Tokenizer suites pass (384 tests), typecheck and eslint are clean. Non-visual, so no screenshots.
User impact
A builder who names a TextInput by a nearby heading, for example
<TextInput label="Email" aria-labelledby="billing-heading" />under a "Billing" heading, loses that name. Screen-reader users hear only "Email", so two Email fields in different sections of the same form sound identical.Problem and solution fit
aria-labelledbyafter the caller's props. Standalone, its own value isundefined, so the caller's value is erased. Inside an InputGroup, the caller's value is replaced with the group and input label ids.component:TextInputFR13 andfamily:input-fieldsFR10 require basearia-*props to reach the native input.Fix: join the caller's ids after the field's own label, the same shape TimeInput uses. When a caller
aria-labelledbyis set, Field gets alabelIDso the visible label stays in the name;aria-labelledbyotherwise replaces the<label for>name.Expected behavior and authority
component:TextInputFR13 (authoritycurrent): "Base props (ref,id,aria-*, …) reach the native input."family:input-fieldsFR10.1 (authoritycurrent): "aria-*… MUST reach the primary semantic control."TimeInput,RadioList,CheckboxList.Smallest restoration
TextInput.tsx: takearia-labelledbyout of the spread props, join it after the field's own label withjoinAriaIDs, and pass Field alabelIDonly when a caller value is set.TextInput.test.tsx: three cases (standalone, inside InputGroup, and unchanged without a caller value).TextInput.spec.md: FR13 and AR1 state where a calleraria-labelledbygoes, and the Verification map row for FR13 lists the new cases.Without a caller
aria-labelledby, the rendered attributes are unchanged. NumberInput, Selector, and MultiSelector have the same defect and follow in separate pull requests.Evidence
Chromium accessibility tree (CDP
Accessibility.getPartialAXTree), Storybook served locally frommain(d9b43cf24b) and from this branch, using a recording-only probe story (not committed) with aBillingheading:mainlabel="Email" aria-labelledby="billing-heading"aria-labelledbyaria-labelledby="<label id> billing-heading"InputGroup label="Contact"label="Email", no caller valuearia-labelledbymain, the caller's id is absent from the input.isLabelHiddenstill keeps "Email" in the name, andaria-labelledby=""leaves the name "Email".aria-labelledby, standalone and grouped.TextInput.tsxreverted tomainand pass with this change.Both recordings use Playwright Chromium at the same 900 × 520 viewport and the same probe story. Each Tab stop's caption is read from Chrome's accessibility tree through CDP at that moment. The caption bar is recording-only.
AS-IS
textinput-as-is.mp4
TO-BE
textinput-to-be.mp4
Writing rubric results
Scope
Testing
pnpm exec vitest run --project ui packages/core/src/TextInput packages/core/src/InputGroup packages/core/src/Field: 302 passed.pnpm -F @astryxdesign/core typecheck, eslint and prettier on the changed files,pnpm check:knowledge,git diff --check: passed.mainversus this branch.Related Issues
Part of #8706