New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SC2-4-4+SC4-1-2-link-name #8
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
501f91d
updated link-names draft rule
WilcoFiers a963c23
update link-names
WilcoFiers 0e427d1
add some algorithms
WilcoFiers 7e52b80
added rendered text algorithm
WilcoFiers 91396d1
Merge branch 'master' into link-names
WilcoFiers b19abe9
Move rule to _drafts
WilcoFiers File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
--- | ||
rule_id: SC2-4-4+SC4-1-2-link-names | ||
name: Links have an accessible name | ||
test_mode: automatic | ||
|
||
criteria: | ||
- 2.4.4 # Link Purpose (In Context) (Level A) | ||
- 4.1.2 # Name, Role, Value (Level A) | ||
|
||
authors: | ||
- Wilco Fiers | ||
--- | ||
|
||
## Description | ||
|
||
This rule checks that all links have an accessible name. | ||
|
||
## Background | ||
|
||
- [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](http://www.w3.org/TR/WCAG20-TECHS/F89.html) | ||
- [ARIA7: Using aria-labelledby for link purpose](https://www.w3.org/TR/WCAG20-TECHS/ARIA7.html) | ||
- [ARIA8: Using aria-label for link purpose](https://www.w3.org/TR/WCAG20-TECHS/ARIA8.html) | ||
|
||
## Assumptions | ||
|
||
*No known assumptions.* | ||
|
||
## Test properties | ||
|
||
| Property | Value | ||
|-------------------|---- | ||
| Test name | Links have an accessible name | ||
| Success Criterion | 2.4.4 Link Purpose (In Context), 4.1.2 Name, Role, Value | ||
| Test mode | automatic | ||
| Test environment | Rendered page | ||
| Test subject | Single web page | ||
|
||
## Test procedure | ||
|
||
### Selector | ||
|
||
Test mode: [automatic][AUTO] | ||
|
||
Select elements matching the following CSS selector: | ||
|
||
a[href]:not([role]), *[role=link] | ||
|
||
### Step 1 | ||
|
||
Test mode: [automatic][AUTO] | ||
|
||
Check if the selected element has an `aria-label` or `aria-labelledby` attribute. | ||
|
||
If yes, continue with [Step 5](#step-5-aria-labels) | ||
|
||
Else, continue with step [Step 2](#step-2-no-aria) | ||
|
||
### Step 2: no ARIA | ||
|
||
Test mode: [automatic][AUTO] | ||
|
||
Concatenate the selected element's [rendered text][RNDTXT] and the text of the `title` attribute, in variable T1. | ||
|
||
If T1 is [non-empty][NEMPTY], return: | ||
|
||
| Outcome | Passed | ||
|----------|----- | ||
| Testcase | SC2-4-4+SC4-1-2-link-names | ||
| ID | SC2-4-4+SC4-1-2-link-names-passed1 | ||
| Info | Link contains text | ||
|
||
Else, continue with [Step 3](#step-3) | ||
|
||
### Step 3 | ||
|
||
Check if the selected element contains an `img` element or an `input` element of `type=image`, | ||
|
||
If yes, continue with [Step 4](#step-4-liked-images) | ||
|
||
Else, return: | ||
|
||
| Outcome | Failed | ||
|----------|----- | ||
| Testcase | {{ page.rule_id }} | ||
| ID | {{ page.rule_id }}-failed1 | ||
| Error | The links must have a name, either though the link text or by the `title` attribute. | ||
|
||
### Step 4: Linked images | ||
|
||
Test mode: [automatic][AUTO] | ||
|
||
Take all images from step 3, that do not have `[role=presentation]` and are not hidden through `display:none` or `visibility:hidden`. | ||
|
||
If there are no such images, return: | ||
|
||
| Outcome | Failed | ||
|----------|----- | ||
| Testcase | {{ page.rule_id }} | ||
| ID | {{ page.rule_id }}-failed2 | ||
| Error | Ensure that images within the link are not ignored by assistive technologies. | ||
|
||
Get the text alternatives of the images using the [Text Alternative Computation][TXTALT] Algorithm. Concatenate the resulting texts into variable T2. | ||
|
||
If T2 contains [non-empty][NEMPTY] text, return: | ||
|
||
| Outcome | Passed | ||
|----------|----- | ||
| Testcase | {{ page.rule_id }} | ||
| ID | {{ page.rule_id }}-passed2 | ||
| Info | The link contains images with a text alternative | ||
|
||
Else return: | ||
|
||
| Outcome | Failed | ||
|----------|----- | ||
| Testcase | {{ page.rule_id }} | ||
| ID | {{ page.rule_id }}-failed3 | ||
| Error | An image is the only content of this anchor and so it should have a text alternative to give a name to the link. | ||
|
||
### Step 5: ARIA labels | ||
|
||
Test mode: [automatic][AUTO] | ||
|
||
Concatenate the selected element's `aria-label` attribute, and the [text content][TXTCNT] of an element referred to with the `aria-labeledby` attribute, in variable T3. | ||
|
||
If T3 contains [non-empty][NEMPTY] text, return: | ||
|
||
| Outcome | Passed | ||
|----------|----- | ||
| Testcase | {{ page.rule_id }} | ||
| ID | {{ page.rule_id }}-passed3 | ||
| Info | The link has an accessible name through ARIA labels | ||
|
||
Dlese, return: | ||
|
||
| Outcome | Failed | ||
|----------|----- | ||
| Testcase | {{ page.rule_id }} | ||
| ID | {{ page.rule_id }}-failed4 | ||
| Error | The link's aria label does not provide an alternative | ||
|
||
[AUTO]: ../pages/test-modes.html#automatic | ||
[MANUAL]: ../pages/test-modes.html#manual | ||
[NEMPTY]: ../pages/algorihms/none-empty.html | ||
[TXTALT]: ../pages/algorithms/text-alternative-compute.html | ||
[RNDTXT]: ../pages/algorithms/rendered-text.html | ||
[TXTCNT]: ../pages/algorithms/text-content.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: Text content | ||
--- | ||
|
||
The textual content is a concatenated string of all text nodes within an element and all textual alternatives within an element. This includes all the [rendered text][] as well as the text alternative returned by the [Text Alternative Computation][] of all `img` elements that are not set to `role=presentation`. The strings are to be concatenated in the order in which they appear in the DOM tree. | ||
|
||
[rendered text]: rendered-text.html | ||
[text alternative computation]: text-alternative.html |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does "
img
element" include elements withrole="img"
or should this be added?