fix(Breadcrumbs): expose collapsed-items count and aria-expanded on expander#634
Open
sridhar-3009 wants to merge 2 commits into
Open
fix(Breadcrumbs): expose collapsed-items count and aria-expanded on expander#634sridhar-3009 wants to merge 2 commits into
sridhar-3009 wants to merge 2 commits into
Conversation
Contributor
|
✅ Changeset found — this change will be included in the next release. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Collapsed breadcrumb items are invisible to screen readers: the ellipsis hardcodes
aria-hidden="true"and is non-interactive, so truncated levels are unreachable by AT and there is no disclosure path to reveal them.This PR makes the ellipsis an optional disclosure toggle and exposes the hidden-item count:
BreadcrumbsEllipsisgains aninteractiveprop. When set,aria-hiddenis no longer hardcoded and the attrs exposearia-expanded(falsecollapsed /trueexpanded), anaria-labelannouncing the hidden count (new locale keyBreadcrumbs.expand, e.g. "Show 3 more breadcrumbs"),role="button"/tabindex="0"when not rendered as a native button, and click + Enter/Space activation. The accessible name stays stable while the disclosure is open. Non-interactive behavior is unchanged.BreadcrumbsRoottracks disclosure state (expanded) andhiddenCountin its context; when expanded, the visibility watcher reveals all collapsed content and keeps the ellipsis visible so it can serve as the collapse toggle.BreadcrumbsItemnow exposesaria-hidden="true"in its slot attrs while collapsed, so renderless consumers that keep collapsed items rendered still remove them from the a11y tree.Breadcrumbs.expandto the built-in English messages.Tests
aria-expanded, count label,role/tabindex, and activation handlers; nativeas="button"omits the redundant onesaria-expandedhiddenCountreturns when collapsed againaria-hidden="true"in slot attrsAll 76 Breadcrumbs tests pass; lint and typecheck clean.
Closes #614