Skip to content

fix(core): name labeled Dividers; single Spinner label announcement - #4370

Merged
cixzhang merged 1 commit into
meta:mainfrom
bhamodi:a11y/content-minors
Jul 30, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
bhamodi:a11y/content-minors

Conversation

@bhamodi

@bhamodi bhamodi commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Two content-component accessibility minors from a11y scan #3:

  • Divider (WCAG 1.3.1 Info and Relationships): a labeled Divider rendered its label as a child of the role="separator" node, but a separator does not derive its accessible name from its content, so the label was never exposed as the separator's name. The separator now references the label element via aria-labelledby (works for both string and arbitrary JSX labels). An explicit consumer aria-label / aria-labelledby takes precedence. ChatSystemMessage's variant="divider" benefits automatically since it renders <Divider label={children} />.
  • Spinner (WCAG 4.1.2 Name, Role, Value): with a visible string label, the inner role="status" span kept aria-label set to the same string that the sibling Text rendered, so screen readers announced the label twice. The status element is now named from the visible Text via aria-labelledby when a string label renders without an explicit aria-label; aria-label is preserved when no visible label exists (default "Loading"), for ReactNode labels, and when explicitly provided.

Changes

  • packages/core/src/Divider/Divider.tsx — add useId-based aria-labelledby wiring from the separator to the rendered label element; explicit aria-label/aria-labelledby win.
  • packages/core/src/Spinner/Spinner.tsx — when a visible string label renders (and no explicit aria-label), drop aria-label from the role="status" span and name it via aria-labelledby pointing at the visible Text; updated the label prop JSDoc.
  • packages/core/src/Divider/Divider.test.tsx — accessible-name tests: string label, ReactNode label, unlabeled (no aria-labelledby), explicit aria-label precedence.
  • packages/core/src/Spinner/Spinner.test.tsx — status named from visible label with no duplicate aria-label; default/explicit aria-label behavior unchanged.
  • packages/core/src/Chat/ChatSystemMessage.test.tsx — divider variant separator has the children as its accessible name.
  • .changeset/a11y-content-minors.md — patch changeset.

Test plan

  • New tests written first and confirmed failing pre-fix: 4 failed (Divider string-label name, Divider ReactNode-label name, ChatSystemMessage separator name, Spinner duplicate aria-label).
  • node_modules/.bin/vitest run packages/core/src/Divider packages/core/src/Spinner packages/core/src/Chat --reporter=dot — 18 files, 197 tests passed.
  • node_modules/.bin/vitest run packages/core --reporter=dot — 222 files, 5164 tests passed (no flakes this run).
  • node_modules/.bin/tsc --project packages/core/tsconfig.json --noEmit — clean.
  • prettier --check and eslint on changed files — clean.
  • node scripts/check-changesets.mjs — 45 changesets valid.

Notes

  • Vercel fork-PR deployment failure is known infra; unrelated to this change.

@vercel

vercel Bot commented Jul 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 26, 2026 4:52am

Request Review

@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Jul 26, 2026
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

Modified Components

Chat
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 5337 -
Complexity N/A Very High (437) -
Divider
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 155 -
Complexity N/A Medium (12) -
Spinner
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 185 -
Complexity N/A High (27) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.7KB 0B

Accessibility Audit

Status: 1 accessibility violation(s) found — 1 serious.

Chat - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/8 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

Generated by PR Enrichment workflow | View full report

@cixzhang
cixzhang enabled auto-merge (squash) July 30, 2026 06:10
@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Jul 30, 2026
@cixzhang
cixzhang merged commit 414c96a into meta:main Jul 30, 2026
20 checks passed
@github-actions
github-actions Bot deleted the a11y/content-minors branch July 30, 2026 08:11

This branch was successfully deployed

1 active deployment
Preview — 490d6488 Deployed Jul 26, 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. community Authored by a community contributor (not on the eng/design team)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants