Skip to content

fix: wire up BottomNavigation Panel aria-labelledby to a real tab id - #5432

Open
zigzagdev wants to merge 1 commit into
uber:mainfrom
zigzagdev:fix/bottom-navigation-aria-labelledby
Open

zigzagdev wants to merge 1 commit into
uber:mainfrom
zigzagdev:fix/bottom-navigation-aria-labelledby

Conversation

@zigzagdev

Copy link
Copy Markdown
Contributor

Motivation

Screen reader users rely on aria-labelledby to hear which tab a given tabpanel belongs to.
Because an attribute pointed at an id nobody rendered, and Panel wasn't even wiring the prop through to the DOM, every BottomNavigation instance was silently broken for assistive technology, with no visible symptom for sighted users.
So, this change restores that association so the component actually meets the accessibility contract its role="tabpanel" markup implies.

Description

BottomNavigation's Panel rendered aria-labelledby pointing at an id string built from the tab's title, but Selector never actually rendered an element with that id.
On top of that, Panel itself did not even accept an aria-labelledby prop, so nothing reached the DOM at all.
As a result, the tab and tabpanel association was unconditionally broken for screen readers.
So, this fix makes Selector accept and render an id prop, makes Panel accept and render aria-labelledby, and has BottomNavigation assign each tab a stable id so every panel's aria-labelledby points at whichever tab actually controls it, including items only reachable through the More overflow tab.
A regression test was added confirming every rendered tabpanel references an id that actually exists in the document.

Scope

Patch (Bug Fix)

Panel's aria-labelledby referenced an id Selector never rendered, and
Panel didn't even forward the prop to the DOM. Give each Selector a
matching id and have Panel accept/render aria-labelledby so tab/tabpanel
associations work for screen readers, including items only reachable
via the "More" overflow tab.
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.

1 participant