WCAG 2.1 H30: Providing link text (wcag/h30)

WCAG 2.1 technique H30 requires each <a> anchor link to have a text describing the purpose of the text. The description may come from plain text or from an image with alternative text.

The purpose of this rule is to ensure users can distinguish the link from other links and determine whenever to follow the link or not. Assistive technology may also present a list of links in which case the description is the only thing the user will be presented with.

Links can be excluded from the accessibility tree with aria-hidden="true".

The rule recognizes the following patterns:

Rule details

Examples of incorrect code for this rule:

<a><img src="cat.gif"></a>
error: Anchor link must have a text describing its purpose (wcag/h30) at inline:1:2:
> 1 | <a><img src="cat.gif"></a>
    |  ^

1 error found.

Examples of correct code for this rule:

<a>lorem ipsum</a>
<a><img src="cat.gif" alt="cat page"></a>
<a aria-label="lorem ipsum"></a>
<a aria-hidden="true"></a>

Version history