Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

taheramr
Copy link
Member

@taheramr taheramr commented Feb 6, 2025

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

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@taheramr taheramr requested a review from a team as a code owner February 6, 2025 12:15
@taheramr taheramr requested review from avinashbot and removed request for a team February 6, 2025 12:15
Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.44%. Comparing base (03d0574) to head (87c2e5e).
Report is 6 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

@@ -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}>
Copy link
Member

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?

Copy link
Member

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.

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.

2 participants