Text splitting prevents screen reader from reading multiword link text

Created on 16 April 2025, 20 days ago
Updated 18 April 2025, 18 days ago

Problem/Motivation

While testing link functionality with VoiceOver on the Mac I noticed that the last word of each external link was not read. In the example markup below I would expect "Search using Google (link is external)" to be read. Instead only "Search using (link is external)" is read. Looking at the markup, the link text is split up into two spans. The last word always seems to be in its own span element. Text splitting like this doesn't tend to work well with screen readers.

<a href="https://google.com" class="px-0 ext" data-extlink="" rel="noreferrer" title="Link is external">Search using <span class="extlink-nobreak" aria-label="(link is external)">Google<span class="fa-ext extlink" role="img" aria-hidden="false"><span class="fa-solid fa-arrow-up-right-from-square ms-1" data-extlink-placement="append"></span></span></span></a>

Note: A bug 🐛 Aria label overrides link text Active in 2.0.4 causes only "External Link" to be read. As a result this can be more easily tested in 2.0.2.

Some background on text splitting

Steps to reproduce

Create a link using the external links module that has a link text of more than word. Use VoiceOver on the Mac to read the link. Observe the last word in the link text will not be read.

Proposed resolution

I can think of two solutions,
1. Remove the span elements that break up the link's text.
2. Make the aria-label for the link the link text + link is external and remove aria labels from the link's span elements

Remaining tasks

User interface changes

The proposed changes should not cause any visual changes to the module

API changes

Data model changes

🐛 Bug report
Status

Needs work

Version

2.0

Component

User interface

Live updates comments and jobs are added and updated live.
Sign in to follow issues

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