The purpose of the link is not clear within its programmatically determined link context.

Link to The purpose of the link is not clear within its programmatically determined link context. copied to clipboard
Rule ID:
link-purpose-unclear
User Impact:
Serious
WCAG:
2.4.4.a

Rule

The purpose of each link MUST be able to be determined from the link text alone, or from the link text and its programmatic context.

Background

Link text, or link text along with the programmatic context of the link, should be sufficient for determining the destination of a link. Meaningful link text helps people choose which links to follow without requiring complicated strategies to understand the page.

When link text — along with its immediately surrounding content — does not completely describe the destination of a link, people who are blind, and people with mobility impairments, reading disabilities, and low vision may have more difficulty understanding the purpose of a link.

In order to sufficiently describe a link's destination, the link text and its programmatic context must provide a complete description of the destination. Whenever possible, provide link text that identifies the purpose of the link without needing to refer to surrounding content. If referring to surrounding content is necessary, the programmatic context can be one of the following:

  1. same sentence, paragraph, list item, or table cell as the link;
  2. in the table header cell for a link in a data table;
  3. via aria-label or aria-labelledby attributes.

Note: Context taken from surrounding text will be most usable if it precedes the link.

Code Examples

Good Examples:

If programmatic context is insufficient, the following examples are ways to add descriptive text to a link.

Descriptive link text:

<p><a href="https://dequeuniversity.com/contact/">Contact Us</a></p>
<h4>Img link alt text</h4>
<pre><code>&lt;a href="https://dequeuniversity.com/curriculum/"&gt;

<img src="info.png" alt="Web accessibility curriculum"> </a>

<h4>Aria-label for link when link text is unclear</h4>
<pre><code>&lt;a href="https://www.si.edu/Museums/air-and-space-museum-udvar-hazy-center"

aria-label="Read more about the Steven F. Udvar-Hazy Center"> Read more... </a>

<h4>Visually hidden descriptive link text</h4>
<pre><code>&lt;a href="https://www.si.edu/Museums/american-history-museum"&gt;

Read more <span class="visually-hidden"> about the National Museum of American History </span> </a>

<h4>Aria-label for link with background image</h4>
<pre><code>&lt;a href="https://www.facebook.com/dequesystems/"

class="facebook-icon" aria-label="Deque's Facebook page"> </a>

Failure Example:

Non-descriptive link text:

<p>Learn more about our products
  <a href="/products.html">here</a>.</p>
<p>To read a fascinating article about the resident microbes in the human body
  <a href="http://tinyurl.com/c3z77jt">click here</a>.</p>
<p>Our second quarter earnings have surpassed investor expectations.
  <a href="surpassed.html">More...</a></p>
<h4>Links to the same page have different text:</h4>
<pre><code>&lt;p&gt;&lt;a href=<span class="highlight">contact.html"</span>&gt;Our Company&lt;/a&gt;&lt;/p&gt;

<p><a href="contact.html">Contact Us</a></p>

<h4>Links to different pages have same text:</h4>
<pre><code>&lt;p&gt;&lt;a href="contact.html"&gt;&lt;/a&gt;<span class="highlight">Contact Us</span>&lt;/a&gt;&lt;/p&gt;

<p><a href="directory.html">Contact Us</a></p>

How To Fix

Fix this issue by using ONE of the following techniques:

  • Provide unique, descriptive link text that conveys the purpose of the link.
  • Ensure that the link text PLUS its programmatic context conveys the purpose of the link.
  • Provide alt text for an img acting as a link that describes the purpose of the link.
  • Provide descriptive link text using an aria-label in the <a> tag. Note that the aria-label text overrides link text completely, so the text in the aria-label itself needs to be sufficient.
  • Provide descriptive link text in a visually hidden text inside the link.
  • Provide an aria-label for a link containing a background-image.

Don't do this:

  • Use the same text for multiple links on a page if they lead to different destinations.
  • Use different link text for multiple links that lead to the same destination.

References