Search code examples
htmlaccessibilityscreen-readers

How to hide a link from a screen-reader?


I have a link which I want to show to visitors with vision, but hide from visitors using screen-reader ATs. (This is not ideal of course).

This is the reverse of the usual problem (with known solution) of hiding content from vision visitors (e.g. a "skip to content" link)

An example:

a box with lede text, and a link to "read more"

Clicking the "read more" link expands the text inline.

the same box, this time with all the text

and conversely, clicking the "read less" link collapses it again.

This collapsed/expanding text functionality is only of benefit to visitors with vision, whose field of view would take in the extra text before they get to it (and in this example displaces the next FAQ, pushing it off screen).

A visitor with a screen-reader should instead be presented with the full text as they can choose to skip ahead to the next block, and they shouldn't encounter a spurious "read more" link which (a) doesn't link to a page, and (b) simply gives them what they were about to hear from their screen reader anyway.

How would this be done in HTML5?


Solution

  • Use aria-hidden this way for the content:

    <p aria-hidden="true">Screen readers will not read this!</p>