Skip to content

fix(Table): drop row tree ARIA outside treegrid - #4690

Open
AKnassa wants to merge 1 commit into
facebook:mainfrom
AKnassa:rocky/issue-4681-aria-conditional-attr
Open

fix(Table): drop row tree ARIA outside treegrid#4690
AKnassa wants to merge 1 commit into
facebook:mainfrom
AKnassa:rocky/issue-4681-aria-conditional-attr

Conversation

@AKnassa

@AKnassa AKnassa commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Part of #4681 (weekly a11y scan). Clears all 10 aria-conditional-attr baseline entries (TableTree x7, TableGroupedRows x3), plus the identical violation in the never-baselined TableTree::Row Click Expansion story.

What this does

The tree and groupedRows Table plugins set aria-expanded (and the tree plugin aria-level) on <tr> elements. Those attributes are only valid on rows inside a treegrid, and Astryx Table is a native <table>, so axe flags every story. Rows now carry no tree ARIA; the expand/collapse state stays announced by the chevron buttons, which already carry aria-expanded (the same pattern the rowExpansion plugin uses, which has zero baseline entries).

Why not role="treegrid" instead

Treegrid contracts the full ARIA grid keyboard model (roving tabindex, arrow-key cell navigation, focusable cells), none of which BaseTable implements. Screen readers would switch users into grid interaction mode and hand them an unnavigable widget. Building that model is a feature decision, not this fix. For groupedRows it is also semantically wrong: group headers are section separators of flat data, not tree parents.

Trade-off, stated plainly

Tree depth is now conveyed visually by indentation only. The removed aria-level was invalid in this context (and unreliably announced because of it), but assistive technology currently gets no programmatic depth cue. A follow-up candidate is announcing the level through the expander's accessible name; the changeset records the same trade-off so it lands as a decision, not a side effect.

What changed

  • Rows lose aria-expanded (both plugins) and aria-level (tree plugin).
  • The tree plugin's per-row ref/subscription machinery existed solely to apply row ARIA and is removed with it (net -77 lines); row-click expansion is unaffected and a dedicated regression review of the removal found no other dependents.
  • Tests rewritten to assert rows never carry these attributes; the chevron buttons remain the single home of the expand state.
  • doc.mjs updated to describe the actual semantics, including the visual-only depth limitation.
  • Baseline: 10 entries removed, deletions only. Changeset (patch) includes a tr[aria-expanded] / tr[aria-level] test-migration hint.

Observation for a follow-up

Local audits report TableGroupedRows::Default::color-contrast and TableGroupedRows::Initially Collapsed::color-contrast as no longer occurring (stale baseline entries). Left untouched here; contrast entries are out of this PR's scope.

Verification

474/474 tests across all 22 Table test files, core typecheck, eslint clean, and the repo's axe audit with --fail-on-new: 0 violations across all 12 TableTree/TableGroupedRows stories.

axe aria-conditional-attr (serious): aria-expanded and aria-level are
valid on rows only inside a treegrid, and Astryx Table is a native
table. The tree and groupedRows plugins set them on every <tr>,
firing on all 10 baselined TableTree/TableGroupedRows stories plus
the never-baselined Row Click Expansion story.

Rows now carry no tree ARIA; expansion state stays announced by the
chevron buttons (rowExpansion-plugin pattern). The per-row
ref/subscription machinery existed solely to apply row ARIA and is
removed with it (-77 lines). Trade-off recorded in the changeset:
depth is currently visual-only via indentation; a programmatic depth
cue for AT is a tracked follow-up. Baseline: -10 entries.

Verified: 474/474 Table tests, core typecheck, eslint clean, axe
audit 0 violations across all 12 stories with --fail-on-new.

Part of facebook#4681.
@vercel

vercel Bot commented Aug 3, 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 Aug 3, 2026 9:43pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 3, 2026
@AKnassa
AKnassa marked this pull request as ready for review August 4, 2026 01:48
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