Problem/Motivation
The home link in the breadcrumb template doesn't have accessible text.
Steps to reproduce
- Install Drupal CMS 2.0
- Add the Accessibility Checker recipe (
editoria11y module)

This is due to incorrect use of the aria-labelledby attribute.
Proposed resolution
Add alt text to the icon. There is already a template variable, perhaps it is acceptable to expose this as a prop in the icon component.
User interface changes
Alt text is added to the icon. The aria-labelledby attribute is removed (it should have a valid ID).
API changes
A new prop is added to the icon component
Comments
Comment #3
jacktonkin commentedComment #4
pameeela commentedThere's no link prop on the icon, so there shouldn't be a a prop for alt text I think? AFAIK the icon only requires alt text if it's linking, otherwise it is by definition decorative?
Comment #5
yeebot commentedThe MR from @jacktonkin looks good to me as it addresses WCAG 2.2 - 1.1.1 Non-text content which relates to non-decorative icons requiring alt text. It ensures the icon has a optional prop to allow it to be populated with meaningful alt text (e.g. "Home") if it exists and treated as decorative if not.
Furthermore it resolves the issue of missing link text, as screen readers can now infer this from the icon alt text.
I retested the MR with the Editoria11y module enabled and the issue was shown to be resolved.
If no one else spots any issues, the MR seems fine to me - though the branch is behind `1.x` now and would need a rebase before it can be merged.
Comment #6
ravi kant commentedAll breadcrumb icons are implemented as SVGs using icon components, and each SVG includes the attribute aria-hidden="true". Therefore, they should not raise any accessibility issues. Additionally, I am not encountering any errors related to the breadcrumb home icon.
Comment #7
pameeela commentedThe icon in the breadcrumb cannot be edited in the UI. The alt text needs to be set directly in the template.
Adding a separate prop for alt text should not be done as part of this issue, it is out of scope.
Comment #11
yeebot commentedI understand that allowing icon alt text is out of scope for this issue, and that we should specifically address the missing link text for the home breadcrumb.
I've therefore submitted a new merge request MR !194 that applies an
aria-labelattribute to the home link for review.Comment #12
pameeela commented@yeebot thank you! So just to confirm, if the
aria-labelis applied, there is no need for alt text?Comment #13
yeebot commentedHi @pameeela - yes, applying
aria-labelto a link overrides any text within the link and is considered a valid WCAG 2.2 Technique for providing link purpose when the link's content is insufficient.In this case, the contents of the home link in the breadcrumb is insufficient because it only contains an SVG icon that is being completely hidden from assistive technology. For context, the UI Icons module allows icons to have alt text but if this is not provided, the markup defaults to
<svg aria-hidden="true" ...>...</svg>. This will always be the case for the Mercury Icon component as it does not use thealtparameter. (I'm not sure if this was intentional as I see the componenticon.twigfile already makes reference thealtparameter used by the UI Icons module twig function, but this is missing from theicon.component.ymlprops which appears to be an inconsistency we could address/prioritise separately. I’m happy to raise an issue if there’s consensus).Regardless, I believe the use of
aria-labelon the link is the more robust solution here, given my understanding that assistive technology support for SVGs may be inconsistent at this point in time.Comment #14
yeebot commentedJust a quick tweak to output the breadcrumb home link text within the link and visually hidden with
sr-onlyas it is preferable to avoid relying on aria when a native solution is possible.Comment #15
pameeela commentedComment #17
pameeela commentedThanks @yeebot for pushing this one forward, sorry it took so long to review!