-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Add proper textual name, role and state to breadcrumb last item #3258
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3258 +/- ##
========================================
Coverage 96.44% 96.44%
========================================
Files 791 791
Lines 22568 22572 +4
Branches 7385 7731 +346
========================================
+ Hits 21765 21769 +4
+ Misses 796 750 -46
- Partials 7 53 +46 ☔ View full report in Codecov by Sentry. |
src/breadcrumb-group/item/item.tsx
Outdated
@@ -70,7 +70,7 @@ type ItemProps = React.HTMLAttributes<HTMLElement> & { | |||
const Item = React.forwardRef<HTMLElement, ItemProps>( | |||
({ anchorAttributes, children, isLast, ...itemAttributes }, ref) => | |||
isLast ? ( | |||
<span ref={ref} className={styles.anchor} {...itemAttributes}> | |||
<span role="link" aria-disabled={true} ref={ref} className={styles.anchor} {...itemAttributes}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I wonder if we should only do this if the last item is focusable in the first place rather than applying it to every last item? Because the problem is only there if we make the element focusable, which is only the case if it's truncated.
I don't have a good answer; something to check with our accessibility specialists later today?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had a chat, here's the outcome:
- It would nice for all terminal breadcrumb group items (not just truncated ones) to be
role="link"
,aria-disabled="true"
, and also tabbable. This makes for a consistent navigation experience through the entire breadcrumb list. - And if we're going to do that, we should also add
aria-current="page"
to the final breadcrumb item.
6e75920
to
9342646
Compare
Description
Adding proper textual name, role and state for the last item in the breadcrumb group.
Why?
At narrow viewports, the truncated final breadcrumb item is focusable, but it has no role and disabled state. (Note: The breadcrumb items are not long enough to trigger truncation in the demo. However, truncation occurs frequently in practice.)
Related links, issue #, if available: n/a
AWSUI-60244
How has this been tested?
Using inspector and inspecting the A11y tree before and after
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md
.CONTRIBUTING.md
.Security
checkSafeUrl
function.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.