Problem/Motivation

The home link in the breadcrumb template doesn't have accessible text.

Steps to reproduce

  1. Install Drupal CMS 2.0
  2. Add the Accessibility Checker recipe (editoria11y module)
  3. A screenshot of the default Privacy Policy page on Drupal CMS with the Mercury Theme.  The accessibility checker is showing the error 'Link with no accessible text' and highlighting the Home icon in the Breadcrumbs .

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

Issue fork mercury-3576399

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jacktonkin created an issue. See original summary.

jacktonkin’s picture

Status: Active » Needs review
pameeela’s picture

Status: Needs review » Needs work

There'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?

yeebot’s picture

The 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.

ravi kant’s picture

StatusFileSize
new66.79 KB

All 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.

pameeela’s picture

The 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.

yeebot’s picture

Status: Needs work » Needs review

I 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-label attribute to the home link for review.

pameeela’s picture

@yeebot thank you! So just to confirm, if the aria-label is applied, there is no need for alt text?

yeebot’s picture

Hi @pameeela - yes, applying aria-label to 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 the alt parameter. (I'm not sure if this was intentional as I see the component icon.twig file already makes reference the alt parameter used by the UI Icons module twig function, but this is missing from the icon.component.yml props 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-label on 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.

yeebot’s picture

Just a quick tweak to output the breadcrumb home link text within the link and visually hidden with sr-only as it is preferable to avoid relying on aria when a native solution is possible.

pameeela’s picture

Title: No alt text for 'Home' link in breadcrumbs » No accessible text for 'Home' link in breadcrumbs
Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

pameeela’s picture

Thanks @yeebot for pushing this one forward, sorry it took so long to review!

  • pameeela committed 0dd69a04 on 1.x authored by yeebot
    feat: #3576399 No accessible text for 'Home' link in breadcrumbs
    
    By:...