accessibility-guidelines

This document is in beta. Help us by reporting issues via Github or email

Back to the overview page

Link purpose

On this page:


Summary

Make sure the purpose of every link is clear from the link text alone, or together with associated content (if screen readers recognise the association).

The purpose of every link must be clear from its link text, or its link text plus associated content if assistive technologies recognise the association.


Requirements

If that’s still not possible:

Common mistakes

Why?

This ensures that screen reader users can understand the purpose of links without reading nearby content, and that speech recognition users can target links accurately using voice commands.

Unique links and navigation items are essential for screen reader and magnification users who may not perceive the context of a link or item. This is especially an issue for users who have not followed the content order.

Official wording in the Web Content Accessibility Guidelines

2.4.4 Link Purpose (In Context): The purpose of each link can be determined from the link text alone or from the link text together with its programmatically determined link context, except where the purpose of the link would be ambiguous to users in general. (Level A)

See the W3C’s detailed explanation of this guideline with techniques and examples.


Guidance for Design

More guidance for design


Guidance for iOS

label.isAccessibilityElement = true
label.accessibilityTraits = [.link]
label.accessibilityHint = "Select to be taken to example.com"

NOTE: Links detected in UITextViews cannot be given a hint so copy will have to be crafted in a way that their purposes are clear in the context in which they are discovered.

More guidance for iOS


Guidance for Android

This section needs more content. Contribute via Github or email.


Guidance for Flutter

This section needs more content. Contribute via Github or email.


Guidance for Web

If a link text taken on its own is ambiguous (for example if multiple links on a page have the same visible text but point to different destinations), you can add visually hidden text to the link to make it clear and unique.

You can use a .visually-hidden CSS class to extend a link’s name without lengthening its visible name:

Example

<style>
.visually-hidden {
  clip-path: inset(100%);
  clip: rect(1px, 1px, 1px, 1px);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}
</style>
...

<h2>Our products</h2>

<h3>Our credit cards</h3>
<p>
    <!-- Some content about credit cards -->
    <a href="page1.html">Lean more <span class="visually-hidden">about our credit cards</span></a>
</p>

<h3>Our loans</h3>
<p>
    <!-- Some content about loans -->
    <a href="page2.html">Learn more <span class="visually-hidden">about our loans</span></a>
</p>

<h3>Our mortgages</h3>
<p>
    <!-- Some content about mortgages -->  
    <a href="page3.html">Learn more <span class="visually-hidden">about our mortgages</span></a>
</p>     
Failure example
<h2>Our products</h2>

<!-- Some content about credit cards -->
<a href="page1.html">Lean more</a>


<!-- Some content about loans -->
<a href="page2.html">Learn more</a>

<!-- Some content about mortgages -->  
<a href="page3.html">Learn more</a>

Common mistakes

More guidance for the Web


More info

Sources

Contribute

This document is in beta. Help us by reporting issues via Github or email