Last updated:

Created by:

Success Criterion:

Description

Each link has an accessible name

Accessibility Requirements

This conformance rule relates to:

Test procedure

Applicability

The rule applies to any HTML element with the semantic role of link that is included in the accessibility tree.

Expectation

Each target element has an accessible name that is non-empty.

Assumptions

Accessibility Support

There are no major accessibility support issues known for this rule.

Background

Test Cases

Passed

Passed example 1

<a> element with accessible name through content.

Code Snippet:
 <a href="http://www.w3.org/WAI"> Web Accessibility Initiative (WAI) </a>
 
Example Output: Open in a new tab/ window

Passed example 2

Element with eplicit role of link with accessible name through content.

Code Snippet:
 <div role="link"> Web Accessibility Initiative (WAI) </div>
 
Example Output: Open in a new tab/ window

Passed example 3

Button with the role of link.

Code Snippet:
 <button role="link">Click me!</button>
 
Example Output: Open in a new tab/ window

Passed example 4

Accessible name for link via aria-label

Code Snippet:
 <a href="http://www.w3.org/WAI"><img src="#" aria-label="This is a link"/></a>
 
Example Output: Open in a new tab/ window

Passed example 5

Link named via title om link.

Code Snippet:
 <a href="http://www.w3.org/WAI" title="This is a link"><img src="#" /></a>
 
Example Output: Open in a new tab/ window

Passed example 6

Link named via title on image.

Code Snippet:
 <a href="http://www.w3.org/WAI"><img src="#" title="This is a link"/></a>
 
Example Output: Open in a new tab/ window

Passed example 7

Link with both image and text.

Code Snippet:
 <a href="http://www.w3.org/WAI"><img src="#" />This is my link text</a>
 
Example Output: Open in a new tab/ window

Passed example 8

Accessible name for link via aria-labelledby.

Code Snippet:
 <a href="http://www.w3.org/WAI"><img src="#" aria-labelledby="id1"/></a>
<div id="id1">This is my link text</div>
 
Example Output: Open in a new tab/ window

Passed example 9

When link is off screen.

Code Snippet:
 <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>
 
Example Output: Open in a new tab/ window

Failed

Failed example 1

Image link without accessible name.

Code Snippet:
 <a href="http://www.w3.org/WAI"><img src="#" /></a>
 
Example Output: Open in a new tab/ window

Failed example 2

Image link where image is marked as decorative.

Code Snippet:
 <a href="http://www.w3.org/WAI"><img src="#" alt="" /></a>
 
Example Output: Open in a new tab/ window

Failed example 3

Link with icon inserted via font-awesome.

Code Snippet:
 <a href="http://www.w3.org/WAI"><i class="fa fa-download"></i></a>
 
Example Output: Open in a new tab/ window

Failed example 4

Link with image that has empty title.

Code Snippet:
 <a href="http://www.w3.org/WAI"><img src="#" title=""/></a>
 
Example Output: Open in a new tab/ window

Failed example 5

Link with image that has empty aria-labelledby.

Code Snippet:
 <a href="http://www.w3.org/WAI"><img src="#" aria-labelledy="id1"/></a>
<div id="id1"></div>
 
Example Output: Open in a new tab/ window

Failed example 6

Aria-labelledby references to a non-existing id.

Code Snippet:
 <a href="http://www.w3.org/WAI"><img src="#" aria-labelledby="id1" /></a>
 
Example Output: Open in a new tab/ window

Failed example 7

Non-visible link.

Code Snippet:
 <a href="http://www.w3.org/WAI" style="left: -9999px; position: absolute;"><img src="#" /></a>
 
Example Output: Open in a new tab/ window

Failed example 8

Not included in the accessibility tree.

Code Snippet:
 <a href="http://www.w3.org/WAI" aria-hidden="true"><img src="#" /></a>
 
Example Output: Open in a new tab/ window

Inapplicable

Inapplicable example 1

<a> element that has had its role changed.

Code Snippet:
 <a href="http://www.w3.org/WAI" role="button">Web Accessibility Initiative (WAI)</a>
 
Example Output: Open in a new tab/ window

Inapplicable example 2

Not included in the accessibility tree due to display:none.

Code Snippet:
 <a href="http://www.w3.org/WAI" style="display: none;"><img src="#" /></a>
 
Example Output: Open in a new tab/ window

Inapplicable example 3

Not included in the accessibility tree due to visibility: hidden.

Code Snippet:
 <a href="http://www.w3.org/WAI" style="visibility: hidden;">Some text</a>
 
Example Output: Open in a new tab/ window

Inapplicable example 10

Not included in the accessibility tree due to aria-hideden="true".

Code Snippet:
 <a aria-hidden="true" href="http://www.w3.org/WAI"> Web Accessibility Initiative (WAI) </a>
 
Example Output: Open in a new tab/ window

Glossary

Included in the accessibility tree

Elements included in the accessibility tree of platform specific accessibility APIs. Elements in the accessibility tree are exposed to assistive technologies, allowing users to interact with the elements in a way that meet the requirements of the individual user.

The general rules for when elements are included in the accessibility tree are defined in the core accessibility API mappings. For native markup languages, such as HTML and SVG, additional rules for when elements are [included in the accessibility tree][] can be found in the HTML accessibility API mappings and the SVG accessibility API mappings.

Note: Users of assistive technologies might still be able to interact with elements that are not included in the accessibility tree. An example of this is a focusable element with an aria-hidden attribute with a value of true. Such an element could still be interacted with using sequential keyboard navigation regardless of the assistive technologies used, even though the element would not be included in the accessibility tree.

Semantic Role

A semantic role is a semantic association that indicates an object’s type. This allows tools to present and support interaction with the object in a manner that is consistent with user expectations about other objects of that type.

Roles can be implicit through the element type or explicit through the role attribute.

The role attribute takes a list of tokens. The semantic role is the first valid role in this list. If none of the tokens are valid, the implicit role will be used instead.

Non-abstract roles defined in the following specifications are considered valid:

Other roles may be added as they become available. Not all roles will be supported in all assistive technologies. Testers are encouraged to adjust which roles are allowed according to the accessibility support base line. For the purposes of executing test cases in all rules, it should be assumed that all roles are supported by assistive technologies so that none of the roles fail due to lack of accessibility support.

Note: For HTML elements the implicit roles are documented in ARIA in HTML.

Accessible Name

The programatically determined name of a user interface element that is included in the accessibility tree.

The accessible name is calculated using the accessible name and description computation.

For native markup languages, such as HTML and SVG, additional information on how to calculate the accessible name can be found in HTML Accessibility API Mappings 1.0, Accessible Name and Description Computation and SVG Accessibility API Mappings, Name and Description.

Non-empty text string

A string of characters (text) is considered “non-empty” if it contains 1 or more characters that are contained within any of the following unicode categories:

  • Ll: Letter, Lowercase
  • Lu: Letter, Uppercase
  • Lt: Letter, Titlecase
  • Lo: Letter, Other
  • Lm: Letter, Modifier
  • Nd: Number, Decimal Digit

For more details on unicode categories, check out www.fileformat.info/info/unicode/category/

Test Aspects

Test aspects are defined as part of the ACT Rules format 1.0.
  • DOM Tree

  • CSS Styling

Contribute






GitHub

Contributing is open to anyone. We welcome any new issues or pull requests for changes. Auto WCAG Rules has conference calls every 4 weeks. If you are interested in becoming an active contributor or reviewer, we ask that you join the Auto WCAG Rules community group through the W3C Website. This requires setting up a W3C account, may require approval by the organization you work for if they are a W3C member.

Learn more about contributing to Auto WCAG Rules Join the Auto WCAG Rules community group now!