id | name | rule_type | description | accessibility_requirements | input_aspects | authors | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c487ae |
Links have an accessible name |
atomic |
Each link has an accessible name
|
|
|
|
The rule applies to any HTML element with the semantic role of link
that is included in the accessibility tree.
Each target element has an accessible name that is not only whitespace.
- The rule assumes that all links are user interface components as defined by WCAG 2. When the link role is used incorrectly, this assumption may not be true.
For area
elements that have a href
attribute, but are not nested inside a map
element, there are differences between browsers and assistive technology on whether the area
is considered included in the accessibility tree or not.
- https://www.w3.org/WAI/WCAG20/quickref/?showtechniques=244#navigation-mechanisms-refs
- ARIA7: Using aria-labelledby for link purpose
- ARIA8: Using aria-label for link purpose
- F89: Failure of Success Criteria 2.4.4, 2.4.9 and 4.1.2 due to using null alt on an image where the image is the only content in a link
<a>
element with accessible name through content.
<a href="http://www.w3.org/WAI"> Web Accessibility Initiative (WAI) </a>
Element with explicit role of link with accessible name through content.
<div role="link">Web Accessibility Initiative (WAI)</div>
Button
with the role of link
.
<button role="link">Click me!</button>
Accessible name for link via aria-label
<a href="http://www.w3.org/WAI"><img src="#" aria-label="This is a link"/></a>
Link named via title
on link.
<a href="http://www.w3.org/WAI" title="This is a link"><img src="#"/></a>
Link named via title
on image.
<a href="http://www.w3.org/WAI"><img src="#" title="This is a link"/></a>
Link with both image
and text
.
<a href="http://www.w3.org/WAI"><img src="#" />This is my link text</a>
Accessible name for link via aria-labelledby
.
<a href="http://www.w3.org/WAI"><img src="#" aria-labelledby="id1"/></a>
<div id="id1">This is my link text</div>
When link
is off screen.
<html>
<style>
.offScreenLink {
position: absolute;
left: -9999px;
top: -9999px;
}
</style>
<body>
<a class="offScreenLink" href="http://www.w3.org/WAI"
>Web Accessibility Initiative (WAI)</a
>
</body>
</html>
area
element with href
attribute has accessible name.
<img
src="planets.gif"
width="145"
height="126"
alt="Planets"
usemap="#planetmap"
/>
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" href="sun.htm" alt="Sun" />
</map>
a
element where accessible name does not only consist of whitespace.
<a href="http://www.w3.org/WAI">:-)</a>
Image link without accessible name.
<a href="http://www.w3.org/WAI"><img src="#"/></a>
Image link where image is marked as decorative.
<a href="http://www.w3.org/WAI"><img src="#" alt=""/></a>
Link with icon inserted via font-awesome.
<a href="http://www.w3.org/WAI"><i class="fa fa-download"></i></a>
Link with image that has empty title.
<a href="http://www.w3.org/WAI"><img src="#" title=""/></a>
Link with image that has empty aria-labelledby
.
<a href="http://www.w3.org/WAI"><img src="#" aria-labelledy="id1"/></a>
<div id="id1"></div>
aria-labelledby
references a non-existing id.
<a href="http://www.w3.org/WAI"><img src="#" aria-labelledby="id1"/></a>
Non-visible link.
<a href="http://www.w3.org/WAI" style="left: -9999px; position: absolute;">
<img src="#" />
</a>
Link is completely empty, but still shows up in focus order, so it should have an accessible name.
<a href="http://www.w3.org/WAI"></a>
area
element with href
attribute does not have accessible name.
<img
src="planets.gif"
width="145"
height="126"
alt="Planets"
usemap="#planetmap"
/>
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" href="sun.htm" />
</map>
a
element where accessible name through content only consist of whitespace.
<a href="http://www.w3.org/WAI"> </a>
<a>
element that has had its role changed.
<a href="http://www.w3.org/WAI" role="button">
Web Accessibility Initiative (WAI)
</a>
Not included in the accessibility tree due to display:none
.
<a href="http://www.w3.org/WAI" style="display: none;"><img src="#"/></a>
Not included in the accessibility tree due to visibility: hidden
.
<a href="http://www.w3.org/WAI" style="visibility: hidden;">Some text</a>
Not included in the accessibility tree due to aria-hidden="true"
.
<a aria-hidden="true" href="http://www.w3.org/WAI">
Web Accessibility Initiative (WAI)
</a>
area
element without href
attribute does not have role of link
.
<area shape="rect" coords="0,0,82,126" />