material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

`aria-current` on last breadcrumb item

Open thany opened this issue 1 year ago • 2 comments

Duplicates

  • [X] I have searched the existing issues

Latest version

  • [X] I have tested the latest version

Summary 💡

I would like to be able to place aria-current="page" on the last <li> in a Breadcrumbs component. Currently, the <li> are completely autogenerated and don't seem to be customisable.

Perhaps a prop to control which item gets this attribute, and/or a way to customise the generated <li>s so devs can pick and choose which aria attribute to add where.

The default behaviour I would like to see added, is aria-current="page" on the last <li>. Any customisation should probably undo-and-override this.

Examples 🌈

image

That one should become <li class="MuiBreadcrumbs-li" aria-current="page">.

Motivation 🔦

Accessibility improvements.

thany avatar Apr 28 '23 16:04 thany

@thany

I have partially fixed your issue, as you already know breadcrumb links are generated dynamically, I can add a fix which can add aria-current='page' at the last element

If I get a green signal, I can push the changes to review.

PunitSoniME avatar Apr 29 '23 09:04 PunitSoniME

Thank you!

I do have to warn you, I'm only like 90% sure that this is the most correct way to indicate the "current" item in the breadcrumbs. There are a couple of other similar ways, and not everyone might agree. Still, it's better than nothing, innit.

thany avatar May 01 '23 01:05 thany

Can't you do this - https://codesandbox.io/s/keen-dewdney-61hxsk ? I don't understand what is the issue.

mnajdova avatar May 23 '23 10:05 mnajdova

Can't you do this - https://codesandbox.io/s/keen-dewdney-61hxsk ? I don't understand what is the issue.

This exactly underlines my point - the internet doesn't have concensus on how to deal with this. It doesn't feel right to put aria-current on just a random <p>. If you think it's right, please go for it and test well.

But also, the last breadcrumb item might not have to be a Typography component; it could just be plain text, and where do you put an attribute on plain text? 🙂

thany avatar May 25 '23 08:05 thany