Warninga11y.link-name

Links with no text

Why it matters

Screen-reader users often move through a page by its links alone, pulled out into a list. A link with no text (a social icon, a logo with no alt, an empty <a> wrapped round a card) is read as "link", or as its address spelt out. Search engines lose something too: the words of a link are how they learn what the page at the other end is about.

Links that do have words, but only "click here" or "read more", are a milder problem and only a notice: in that list of links, six of them say "read more" and nothing tells them apart. The guidelines accept a link whose purpose is clear from the sentence around it, so this is about being kind rather than being wrong.

Sources: WCAG 2.2, 2.4.4 Link Purpose (In Context) and 4.1.2 Name, Role, Value (both Level A); Google on anchor text.

How to fix it

An icon or image link needs a name of its own:

<a href="https://instagram.com/flourandco" aria-label="Flour & Co on Instagram">
    <svg aria-hidden="true">…</svg>
</a>
<a href="/"><img src="/logo.svg" alt="Flour & Co home"></a>

For "read more", put the subject in the link, or add it for screen readers only:

<a href="/blog/sourdough">Read more<span class="sr-only"> about our sourdough</span></a>

Examples

These are the rule's own test pages, and what it says about each. They are run on every change to the rule book.

<p>Our sourdough takes three days. <a href="/blog/sourdough">Click here</a>
</p>

Notice1 link says only "Click here" or the like. Read out in a list of links, nothing says where it goes.

fail-click-here
<a class="social" href="https://instagram.com/flourandco">
<i class="icon-instagram">
</i>
</a>

Warning1 link has no text, so a screen reader says only "link" or reads out the address: a.social.

fail-icon-link
<a href="/">
<img src="/logo.svg" alt="Flour &amp; Co home">
</a>

PassedEvery link has text that says something (1 link).

pass-image-alt
<p>
<a href="/blog/sourdough">How our sourdough takes three days</a>
</p>

PassedEvery link has text that says something (1 link).

pass-named