Sc2 4 4 Link purpose

Please note, this is a draft

Background

Assumptions

Test properties

Property Value
Test name Link Purpose
Success Criterion 2.4.4 Link Purpose (In Context)
Test mode SemiAuto
Test environment HTML source or DOM
Test subject Single web page

Test procedure

Selector

Test mode: automatic

Step 1 - Check for Accessible Name

Test mode: automatic

For each link, use the accessible name algorithm to derive the link’s accessible name: see HTML to Platform Accessibility APIs Implementation Guide - section 6.10

If link has an aria-labelledby attribute, the link’s accessible name is the value of its associated element.

Otherwise check for aria-label. If an aria-label attribute is present, the link’s accessible name is the text string value of that attribute.

Otherwise use the a element subtree (value of the link content, if any). This include alt texts for images.

Otherwise use the link’s title attribute.

If none of the above yield a usable text string for the link: return

Outcome Failed
Testcase SC2-4-4-link-text
ID SC2-4-4-link-text-fail1
Error No accessible name for link.

else go to [Step 2]

Step 2 - Check for Uniqueness.

Test mode: automatic

Compare the calculated accessible names (see step 1) of all links on the page.

If all accessible names are unique, return:

Outcome Passed
Testcase SC2-4-4-link-text
ID SC2-4-4-link-text-pass1

else go to Step 3

Test mode: automatic

The following data structure is necessary for the remaining steps in this test:

Now you have a collection of links grouped by their accessible names. In other wordsWithin each group item, all links have the same accessible name. We know we have at least one group item, since we got past Step 2. In the remaining steps we need to check for other factors that may explain why link texts are the same, and determine whether other factors exist that distinguish link texts.

If a group item of links fails all checks, the test fails.

Check if links with identical accessible name go to the same destination.

If all links in a group item go to same destination, return

Outcome Passed
Testcase SC2-4-4-link-text
ID SC2-4-4-link-text-pass2

else go to Step 4

Step 4 - Add Accessible Description

Test mode: automatic

For each link in a group of links with identical accessible name:

Compute the link´s accessible description (see html to platform guide, section 6.10 as referenced above).

Compare links with their accessible names combined with their accessible descriptions.

If the combination of accessible name and accessible description uniquely identifies all links in a group item, return:

Outcome Passed
Testcase SC2-4-4-link-text
ID SC2-4-4-link-text-pass3

else go to Step 5

Step 5 - Calculate Context

Test mode: automatic

Explore links together with their programmatically determined link context

This includes textual content of:

For each link, construct a variable which contains the link’s accessible name, description and context. Repeat the uniqueness check.

If all links in a group item, considered together with their computed accessible description and programatically determinable context are unique: Return

Outcome Passed
Testcase SC2-4-4-link-text
ID SC2-4-4-link-text-pass4

else go to Step 6

Test mode: manual

(links may be ambiguous to users in general, need interactive testing). For all remaining links in a given group item, present them to human testers. Ask the testers if they can uniquely identify the purpose of each link within a group from its on-screen location or visible context.

User Input Question:

Property Value
Presented item A set of links with identical name/accessible description and context as well as their location on the webpage highlighted visually.
Requires context Yes links on screen (links in visual context)
Requires Interaction No (unless we recommend user activates and follows each link, which we might want to do)
Question “The text description of these x links is the same. By looking at the screen, can you visually identify the purpose of these links better than the text can?
Help The link text presented to you should uniquely identify the purpose of each link on the page. For these links that is not the case. Can you, by looking at the links on your screen, identify the different destinations or context of these links better than by just looking at the accessible link text?
repair What would you propose as a good text description of the link, e.g. for those who can’t see it on the screen?

If yes return

Outcome Failed
Testcase SC2-4-4-link-text
ID SC2-4-4-link-text-fail2
Error Link text, together with description and context, is not sufficient to identify the link purpose.

else (link text meant to be ambiguous to all users), return

Outcome Passed
Testcase SC2-4-4-link-text
ID SC2-4-4-link-text-pass5