Smart trim makes "Read more" links less accessible than core

Created on 17 August 2020, over 4 years ago
Updated 9 January 2025, 3 months ago

Problem/Motivation

In Drupal 7 core, the text on the "Read more" links is actually Read more<span class="element-invisible"> about @title</span>. The invisible text is for accessibility: screen reader users frequently read through all the links on the page, or need to jump to a specific link (by its text), and without this, all the "Read more" links sound the same.

If you use smart_trim, the "Read more" links don't include the invisible text for screen readers making them less accessible.

Steps to reproduce

  1. Create a new content type
  2. Change the formatter used to display the Body field to "Smart trimmed"
  3. Click the gear to change the formatter settings, and change "Display more link?" to "Always" and save
  4. Create a piece of content with this type and view it to see the "Read more" link
  5. View page source or use web developer tools to inspect the DOM and see that there is no invisible text

Proposed resolution

The default text for the "Read more" links should match core. Since smart_trim allows customizing the link text, the invisible text will need to be customizable too (so it makes sense).

I propose actually setting it to Read more<span class="element-invisible"> about @title</span> and having smart_trim fill in the @title.

This has an additional advantage: by using the exact same text that core uses (and passes to t()) this will also allow using the same translations as core, and so will be good for i18n too (improving a11y and i18n in one patch!).

Remaining tasks

  1. Write patch
  2. Test patch
  3. Merge patch

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States dsnopek USA

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