In #1329786: JS refactoring, we helped with screen reader compatibility by using D7's new "element-invisible" class. This makes it so when screen readers encounter an external link, they announce it. However, the message currently read is "External Links icon". A more helpful description would be something like "link is external", so it describes the significance of the icon instead of describing that it is an icon.

In addition, we're currently using invalid HTML, placing a DIV inside a SPAN. We should use a span for the invisible element.

And lastly, screen readers can't announce links as external unless the icon is part of the link. If we move the icon to inside the link, this both announces links when they're selected and it makes them clickable, as requested in #544074: Extlink Icon clickable link.

Comments

quicksketch’s picture

This patch addresses all the above issues:

- Moves icon inside of link so it receives focus and is read by screen readers.
- Switches the invisible element to use a span instead of a div.
- Replaces the screen reader message with reasonable descriptions.

Some comments on the approach:

- This uses variables to get the message, allowing users to change it via settings.php if the really desire to customize it. In addition, passing the message via Drupal.settings saves locale module the work of parsing and replacing the Drupal.t() calls.
- I also added a small amount of CSS so the icon doesn't end up with an underline.

quicksketch’s picture

Status: Active » Needs review
StatusFileSize
new3.11 KB

Actual patch...

quicksketch’s picture

Status: Needs review » Fixed

Pushed to the 7.x-1.x branch.

  • Commit ba6b8ec on 7.x-1.x by quicksketch:
    Issue #2255295: Improve compatibility with screen readers.
    

Status: Fixed » Needs work

The last submitted patch, 2: extlink_screen_readers-2255295.patch, failed testing.

quicksketch’s picture

Status: Needs work » Fixed

Silly testbot.

roball’s picture

elachlan’s picture

Thanks for the report. The patch will need to be reworked.

elachlan’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.