Skip to content

fix: only set aria-controls on the active tab - #744

Open
smartcalsystems-sketch wants to merge 1 commit into
MergeFi:mainfrom
smartcalsystems-sketch:fix-tabs-inactive-ariacontrols-710
Open

smartcalsystems-sketch wants to merge 1 commit into
MergeFi:mainfrom
smartcalsystems-sketch:fix-tabs-inactive-ariacontrols-710

Conversation

@smartcalsystems-sketch

Copy link
Copy Markdown

Problem

Every tab sets aria-controls={tabpanel-${tab.key}}, but ContributorDashboardClient renders only the active panel (id={tabpanel-${tab}}). The inactive tab's aria-controls points at a missing id, an ARIA reference error flagged by axe and confusing for assistive tech that follows the relationship.

Fix

Took the issue's second suggested option — omit aria-controls on inactive tabs — rather than rendering every panel and hiding inactive ones with hidden. No consumer of Tabs today renders more than the active panel, so always-rendering every panel would be a bigger, unrelated change to introduce here just to keep a reference valid; omitting the attribute when there's nothing valid for it to point at is the more surgical fix.

Testing

  • Added 3 tests: the active tab gets aria-controls, inactive tabs don't get it at all, and the attribute correctly moves when a different tab becomes active.
  • Full Tabs.test.tsx: 19/19 passing (16 pre-existing + 3 new). ContributorDashboardClient.test.tsx: 5/5 passing, zero regressions.
  • tsc --noEmit and eslint clean on both changed files.

Closes #710

Every tab set aria-controls={`tabpanel-${tab.key}`}, but consumers like
ContributorDashboardClient render only the active panel (a single
id={`tabpanel-${tab}`}). Every inactive tab's aria-controls therefore
pointed at an id that doesn't exist in the DOM -- an ARIA reference
error flagged by axe and confusing for assistive tech following the
relationship.

Omit aria-controls entirely on inactive tabs rather than rendering
every panel and hiding the inactive ones, since no consumer of this
component currently renders more than the active panel.
@vercel

vercel Bot commented Oct 13, 2026

Copy link
Copy Markdown

@smartcalsystems-sketch is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tabs reference an inactive tab's tabpanel id that doesn't exist in the DOM

1 participant