A11y: add screen reader text for external links

Created on 14 May 2019, over 5 years ago
Updated 15 July 2024, 5 months ago

Problem/Motivation

The external link module adds a visual indicator that a link is external. To create this same experience for an unsighted user, there needs to be some screen-reader only text that serves the same purpose. This text should be something like <span class="sr-only">Link is external</span>.

Additionally, accessibility standards require that people are warned when a link will open a new window.

This module offers the ability to force external links to open in new windows, but when that option is selected, we also need to add a warning about this behavior. Because new windows can be hard to navigate with screen-readers, many people would prefer not to click the link if there is a chance they can't get back to the originating site.

Proposed resolution

When the option to force links to open in new windows IS NOT selected

<a href="https://bayareametro.zoom.us/j/85868739599" rel="nofollow noopener noreferrer" class="ext" data-extlink="">
   Attend on Zoom
  <span class="fa-ext extlink">
    <span class="fa fa-external-link"></span>
    <span class="sr-only">Link is external.</span>
  </span>
</a>

When the option to force links to open in new windows IS selected

<a href="https://bayareametro.zoom.us/j/85868739599" rel="nofollow noopener noreferrer" class="ext" data-extlink="" target="_blank">
   Attend on Zoom
  <span class="fa-ext extlink">
    <span class="fa fa-external-link"></span>
    <span class="sr-only">link is external, and opens a new window.</span>
  </span>
</a>

Original Issue Summary

Hello,

Working on a project very concerned with the accessibility and using the module external link, I had to create a feature for the screen reader to tell for each external link of the site that it will open in a new window .

I will upload the patch regarding this feature.

✨ Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡«πŸ‡·France Piegefull

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

  • Needs reroll

    The patch will have to be re-rolled with new suggestions/changes described in the comments in the issue.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024