-
Notifications
You must be signed in to change notification settings - Fork 79
New Rule: Links with identical accessible names serve equivalent purpose #220
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
Merged
annethyme
merged 95 commits into
develop
from
SC2-4-9-links-with-identical-accessible-names-have-same-purpose
May 15, 2019
Merged
Changes from all commits
Commits
Show all changes
95 commits
Select commit
Hold shift + click to select a range
1709582
Create SC2-4-9-links-with-identical-accessible-names-have-same-purpos…
33b71ec
Update SC2-4-9-links-with-identical-accessible-names-have-same-purpos…
1a071d1
Create index.html
f849efa
Update SC2-4-9-links-with-identical-accessible-names-have-same-purpos…
ab30e98
fix: Add new glossary - url normalisation
jeeyyy 93df4f5
Editorial updates per feedback
7f7f62a
New "included in the accessbility tree" definition
1fc6ce8
Adding "non-empty" to acc. name in Applicability
0e69ff9
"are using" --> "use"
6271038
Linking to WHATWG instead of HTML4 draft
be8fe35
Referring to URL parsing instead of normalization
7781068
Removing notes to put into definition
2c66aab
Create equivalent-purpose.md
0b005b9
Removed notes that went into definition
6e2fa6e
Replaced with link to URL parsing
160193a
removed one more note
6245142
Added case-(in)sensitivity
dbfcac5
Removed case-sensitivity test case
6a59968
Added missing quotation marks in test case code
8d45d21
Changing filename to hex id
965631a
Create index.html
ebb1608
Create redirect.html
8893f03
Create index-copy.html
67a36ad
Create contact.html
6879e8a
Create contact.html
e3fe636
Create page1.html
bee8840
Create page2.html
503c19c
Create page3.html
dd11a8e
Create contact.html
63bc07c
Updated links in test cases
467d215
Update index-copy.html
4adeb0d
Delete index.html
496872d
Update redirect.html
a3e11a5
Update redirect.html
6acc56f
Update page1.html
6d75e1c
Update page2.html
d8f3972
Update page1.html
65fa6f6
Update page3.html
aa5f0d5
Update page3.html
804fe7a
More clarification to definition
af32ee8
Update contact.html
6d7299f
Update contact.html
0dfcdae
Create page4.html
20d5b67
Edited test cases
04314c2
Create contact.html
32cdcb4
Delete contact.html
e1140ae
Update 6cbcbe.md
4fc1956
Delete page4.html
ad4e40b
Update 6cbcbe.md
af0f5dc
Update 6cbcbe.md
bee70f5
Updated per Carlos' comments
e9875ca
Editorial
d284420
Update equivalent-purpose.md
073780e
Update 6cbcbe.md
e7dd836
Editorials
f231bbe
Create same-resource.md
6ad40c0
Remove stuff from new "same resources" definition
31227da
Expectation split out in two
b5f327f
Editorials: Terminology in test case descriptions
caa1cf9
Test case description clean up
bd803d8
Update test case
de93324
Taking into account redirects in user agents
e1fc64c
Sharpening test case description (Passed #5)
a2ad7f9
Applicability incl. roles that inherit from link
d97c325
Clarifying the assumption
bfd7052
Editorials per Carlos
9d1c29f
Editorials to clarify per Carlos' comments
822f48b
Added SVG test cases
54913d0
tabindex="-1" added to Inapplicable example 3
ae8ccf5
Create matching-text-content.md
d510fdc
Update matching-text-content.md
bfda52a
Update matching-text-content.md
c16eb3a
Using "matching text content" def. in appl.
2f9d2ca
"non-empty" updated to "that contain text content"
f63dc48
Update matching-text-content.md
5df0fd0
Clarifying: test target is a full set of elements
a9c0a69
Rename matching-text-content.md to matching-characters.md
fff5934
links activated --> links followed
7d2e1df
"applies to a set" --> "applies to any set..."
967fbf8
Specifying that redirect has to be instant to pass
fa65c98
Create redirect1.html
e25e4bc
Update 6cbcbe.md
950f48b
Remove note
30b96da
Update and rename equivalent-purpose.md to equivalent-resource.md
5060bcc
Update 6cbcbe.md
a945766
Update 6cbcbe.md
92ec5c9
tabindex="0" added to `span`s with role=link
0c92ddf
Editorial cleanup
95244c5
Test case descr.: "Link text" > "accessible name"
0f70f35
Grammar corrections and editorials
7898973
Update assumption for readability/understanding
694499b
Add id to frontmatter of rule
15a1c03
Update template to match new format
4fc8044
Removed new line in Expectation
fbc10f8
Moved example into a note
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,281 @@ | ||
| --- | ||
| id: b20e66 | ||
| name: Links with identical accessible names serve equivalent purpose | ||
| rule_type: atomic | ||
|
|
||
| description: | | ||
| This rule checks that links with identical accessible names resolve to the same resource or equivalent resources. | ||
|
|
||
| accessibility_requirements: | ||
| wcag20:2.4.9: # Link Purpose (Link Only) (AAA) | ||
| forConformance: true | ||
| failed: not satisfied | ||
| passed: further testing needed | ||
| inapplicable: further testing needed | ||
|
|
||
| input_aspects: | ||
| - DOM Tree | ||
| - CSS Styling | ||
|
|
||
| authors: | ||
| - Anne Thyme Nørregaard | ||
| --- | ||
|
|
||
| ## Applicability | ||
|
|
||
| This rule applies to any set of any two or more HTML or SVG elements that have the [semantic role](#semantic-role) of `link`, or a role that inherits from the `link` role, are [included in the accessibility tree](#included-in-the-accessibility-tree), and that have [matching](#matching-characters) [accessible names](#accessible-name) that do not only consist of [whitespace](#whitespace). | ||
|
|
||
| **Note:** The test target for this rule is the full set of link elements that share the same [matching](#matching-characters) [accessible name](#accessible-name). | ||
|
|
||
| ## Expectation | ||
|
|
||
| When followed, the links in each set of target elements resolve to the [same resource](#same-resource) or to [equivalent resources](#equivalent-purpose). Resolving the links includes potential redirects, if the redirects happen instantly. | ||
|
|
||
| ## Assumptions | ||
|
|
||
| This rule assumes that the purpose of the links with identical accessible names would not be ambiguous to users in general when seen in context on the web page, which is the exception mentioned in success criterion [2.4.9 Link Purpose (Link Only)](https://www.w3.org/WAI/WCAG21/Understanding/link-purpose-link-only.html). If the links are ambiguous to users in general, users of assistive technologies are not at a disadvantage when viewing the links out of context, e.g. on a list of links in a screen reader, which makes it more of a general user experience concern than an accessibility issue. | ||
|
|
||
| ## Accessibility support | ||
|
|
||
| There are no major accessibility support issues known for this rule. | ||
|
|
||
| ## Background | ||
|
|
||
| - [Understanding Success Criterion 2.4.9: Link Purpose (Link Only)](https://www.w3.org/WAI/WCAG21/Understanding/link-purpose-link-only.html) | ||
| - [URL parsing](https://www.w3.org/TR/html52/infrastructure.html#parsing-urls) | ||
|
|
||
| ## Test Cases | ||
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong. |
||
|
|
||
| ### Passed | ||
|
|
||
| #### Passed Example 1 | ||
|
|
||
| A set of two HTML `<a>` elements have the same accessible name and link to the same resource. | ||
|
|
||
| ```html | ||
| <a href="/test-assets/6cbcbe/index.html">Contact us</a> | ||
| <a href="/test-assets/6cbcbe/index.html">Contact us</a> | ||
| ``` | ||
|
|
||
| #### Passed Example 2 | ||
|
|
||
| Links resolves to same resource after instant redirect: | ||
|
|
||
| ```html | ||
| <a href="/test-assets/6cbcbe/index.html">Contact us</a> | ||
| <a href="/test-assets/6cbcbe/redirect.html">Contact us</a> | ||
| ``` | ||
|
|
||
| #### Passed Example 3 | ||
|
|
||
| Resources are not the same, since the links resolve to different URLs, but the resources are completely identical, thus serving the same purpose: | ||
|
|
||
| ```html | ||
| <a href="/test-assets/6cbcbe/index.html">Contact us</a> | ||
| <a href="/test-assets/6cbcbe/index-copy.html">Contact us</a> | ||
| ``` | ||
|
|
||
| #### Passed Example 4 | ||
|
|
||
| Same link text used for links going to pages where the content section is the same, but where the navigation options (bread crumbs and local sub menus) differ due to different placement in navigation hierarchy: | ||
|
|
||
| ```html | ||
| <a href="/test-assets/6cbcbe/about/contact.html">Contact us</a> | ||
| <a href="/test-assets/6cbcbe/careers/contact.html">Contact us</a> | ||
| ``` | ||
|
|
||
| #### Passed Example 5 | ||
|
|
||
| URLs differ due to trailing slashes, but resolves to the same resource after redirects caused by user agent: | ||
|
|
||
| ```html | ||
| <a href="/test-assets/6cbcbe/">Contact us</a> | ||
| <a href="/test-assets/6cbcbe">Contact us</a> | ||
| ``` | ||
|
|
||
| #### Passed Example 6 | ||
|
|
||
| Pages contain different amounts of information and/or differently worded information, but fulfil the same purpose in relation to the link: | ||
|
|
||
| ```html | ||
| <a href="/test-assets/6cbcbe/page1.html">Call us</a> | ||
| <a href="/test-assets/6cbcbe/page2.html">Call us</a> | ||
| ``` | ||
|
|
||
| #### Passed Example 7 | ||
|
|
||
| Pages have the same advertised key content but use different layouts: | ||
|
|
||
| ```html | ||
| <a href="/test-assets/6cbcbe/page1.html">Contact us</a> | ||
| <a href="/test-assets/6cbcbe/page3.html">Contact us</a> | ||
| ``` | ||
|
|
||
| #### Passed Example 8 | ||
|
|
||
| Links created via scripting with explicit role of link, but lead to the same resource: | ||
|
|
||
| ```html | ||
| <span role="link" tabindex="0" | ||
| onclick="location='/test-assets/6cbcbe/index.html'"> | ||
| Link text | ||
| </span> | ||
|
|
||
| <span role="link" tabindex="0" | ||
| onclick="location='/test-assets/6cbcbe/index.html'"> | ||
| Link text | ||
| </span> | ||
| ``` | ||
|
|
||
| #### Passed Example 9 | ||
|
|
||
| A set of two SVG `<a>` elements have the same accessible name and link to the same resource. | ||
|
|
||
| ```html | ||
| <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | ||
| <a href="http://facebook.com" aria-label="Follow us"> | ||
| <circle cx="50" cy="40" r="35"/> | ||
| </a> | ||
|
|
||
| <a href="http://facebook.com"> | ||
| <text x="50" y="90" text-anchor="middle"> | ||
| Follow us | ||
| </text> | ||
| </a> | ||
| </svg> | ||
| ``` | ||
|
|
||
| ### Failed | ||
|
|
||
| #### Failed Example 1 | ||
|
|
||
| Same accessible name used for links going to different resources: | ||
|
|
||
| ```html | ||
| <a href="http://facebook.com">Follow us</a> | ||
| <a href="http://twitter.com">Follow us</a> | ||
| ``` | ||
|
|
||
| #### Failed Example 2 | ||
|
|
||
| Same accessible name used for links going to web pages that are similar, but have different information in their content: | ||
|
|
||
| ```html | ||
| <a href="/test-assets/6cbcbe/about/contact.html">Contact us</a> | ||
| <a href="/test-assets/6cbcbe/admissions/contact.html">Contact us</a> | ||
| ``` | ||
|
|
||
| #### Failed Example 3 | ||
|
|
||
| Links created via scripting with explicit role of link, but lead to resources that offer different content: | ||
|
|
||
| ```html | ||
| <span role="link" tabindex="0" | ||
| onclick="location='/test-assets/6cbcbe/about/contact.html'"> | ||
| Link text | ||
| </span> | ||
|
|
||
| <span role="link" tabindex="0" | ||
| onclick="location='/test-assets/6cbcbe/admissions/contact.html'"> | ||
| Link text | ||
| </span> | ||
| ``` | ||
|
|
||
| #### Failed example 4 | ||
|
|
||
| Same accessible name used for image links going to different resources: | ||
|
|
||
| ```html | ||
| <a href="http://facebook.com"><img src="facebook.jpg" alt="Follow us" /></a> | ||
| <a href="http://twitter.com"><img src="twitter.jpg" alt="Follow us" /></a> | ||
| ``` | ||
|
|
||
| #### Failed Example 5 | ||
|
|
||
| A set of two SVG `<a>` elements have the same accessible name but link to different resources: | ||
|
|
||
| ```html | ||
| <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | ||
| <a href="http://facebook.com" aria-label="Follow us"> | ||
| <circle cx="50" cy="40" r="35"/> | ||
| </a> | ||
|
|
||
| <a href="http://twitter.com"> | ||
| <text x="50" y="90" text-anchor="middle"> | ||
| Follow us | ||
| </text> | ||
| </a> | ||
| </svg> | ||
| ``` | ||
|
|
||
| #### Failed Example 6 | ||
|
|
||
| Links resolves to same resource after redirect, but the redirect is not instant: | ||
|
|
||
| ```html | ||
| <a href="/test-assets/6cbcbe/index.html">Contact us</a> | ||
| <a href="/test-assets/6cbcbe/redirect1.html">Contact us</a> | ||
| ``` | ||
|
|
||
| ### Inapplicable | ||
This comment was marked as resolved.
Sorry, something went wrong. |
||
|
|
||
| #### Inapplicable Example 1 | ||
|
|
||
| ´a´ and ´area´ elements without ´href´ attribute: | ||
|
|
||
| ```html | ||
| <a>Link text</a> | ||
| <area aria-label="Link text"> | ||
| ``` | ||
|
|
||
| #### Inapplicable Example 2 | ||
|
|
||
| Links with different accessible names: | ||
|
|
||
| ```html | ||
| <a href="/test-assets/6cbcbe/about/contact.html">Contact main office</a> | ||
| <a href="/test-assets/6cbcbe/admissions/contact.html">Contact admissions office</a> | ||
| ``` | ||
|
|
||
| #### Inapplicable Example 3 | ||
|
|
||
| Link is not included in the accesssibility tree: | ||
|
|
||
| ```html | ||
| <a href="/test-assets/6cbcbe/page1.html" aria-hidden="true" tabindex="-1">Contact Us</a> | ||
| <a href="/test-assets/6cbcbe/pabe2.html">Contact Us</a> | ||
| ``` | ||
|
|
||
| #### Inapplicable example 4 | ||
|
|
||
| Links created via scripting, but without the semantic role of link: | ||
|
|
||
| ```html | ||
| <span | ||
| onclick="location='/test-assets/6cbcbe/page1.html'"> | ||
| Contact Us | ||
| </span> | ||
|
|
||
| <span | ||
| onclick="location='/test-assets/6cbcbe/page2.html'"> | ||
| Contact Us | ||
| </span> | ||
| ``` | ||
|
|
||
| #### Inapplicable Example 5 | ||
|
|
||
| Links do not have accessible names: | ||
|
|
||
| ```html | ||
| <a href="http://facebook.com"></a> | ||
| <a href="http://twitter.com"></a> | ||
| ``` | ||
|
|
||
| #### Inapplicable Example 6 | ||
|
|
||
| Image links do not have accessible names: | ||
|
|
||
| ```html | ||
| <a href="http://facebook.com"><img src="facebook.jpg" /></a> | ||
| <a href="http://twitter.com"><img src="twitter.jpg" /></a> | ||
| ``` | ||
This file contains hidden or 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,18 @@ | ||
| --- | ||
| title: Equivalent resource | ||
| key: equivalent-resource | ||
| --- | ||
|
|
||
| Non-identical resources can still be equivalent by equally complying to the expectation formed by the user when navigating to them, thus serving an equivalent purpose. This would usually involve that the advertised key content is the same. | ||
|
|
||
| Web pages and documents (e.g. PDFs, office formats etc.) may be equivalent resources, even if the resources: | ||
| * are located on different URLs, including different domains | ||
| * present different navigation options, e.g. through bread crumbs or local sub menus | ||
| * contain different amounts of information and/or differently worded information | ||
| * use different layouts. | ||
|
|
||
| If all resources cover the user's expectations equally well, the resources are considered to be equivalent. | ||
|
|
||
| **Note:** The user's expectations for the resource can be formed by different things, e.g. the name of the link leading to the resource, with or without the context around the link. This depends on the accessibility requirement that is tested. | ||
|
|
||
| **Note:** If the same content is presented in different formats or languages, the format or language itself is often part of the purpose of the content, e.g. an article as both HTML and PDF, an image in different sizes, or an article in two different languages. If getting the same content in different formats or languages is the purpose of having seperate links, the resources are not equivalent. |
This file contains hidden or 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,6 @@ | ||
| --- | ||
| title: Matching characters | ||
| key: matching-characters | ||
| --- | ||
|
|
||
| A sequence of [characters](#character) is considered to match another if, after removing leading and trailing [space characters](https://www.w3.org/TR/html/infrastructure.html#space-characters) and replacing remaining occurrences of one or more space characters with a single space, the two sequences of characters are equal character-by-character, ignoring any differences in letter casing. |
This file contains hidden or 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,14 @@ | ||
| --- | ||
| title: Same resource | ||
| key: same-resource | ||
| --- | ||
|
|
||
| Two or more resources can be the same resource even though the URLs for them are different. This can be due to URL parsing, server settings, redirects and DNS aliasing. | ||
|
|
||
| If the [parsed URLs](https://www.w3.org/TR/html52/infrastructure.html#parsing-urls) for two resources are identical, the resources are the same resource. | ||
|
|
||
| Depending on the server, URLs can either be case-sensitive or case-insenstive, meaning that `<a href="page1.html">` and `<a href="Page1.html">` leads to either the same or two different pages. | ||
|
|
||
| Fully parsed URLs can be different, but still lead to the same resource after making the HTTP request, due to redirects and DNS aliasing. For example, these URLs are all fully normalised: http://example.com/, http://www.example.com/, https://www.example.com/. The server can however be configured to serve the same site for http and https, and the same site for example.com and www.example.com. This is common, but not guaranteed. | ||
|
|
||
| Some types of redirects are also caused by user agents, e.g. ensuring that http://example.com/ and http://example.com resolves to the same resource. |
This file contains hidden or 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,27 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <title>About - Contact</title> | ||
| </head> | ||
| <body> | ||
| <nav label="main menu" style="text-align: right;"> | ||
| <a href="../about.html">About</a> | ||
| <a href="../admissions.html">Admissions</a> | ||
| <a href="../careers.html">Careers</a> | ||
| </nav> | ||
| <nav label="breadcrumb"><p>You are here: <a href="../about.html">About</a> / Contact us</p></nav> | ||
| <nav label="submenu" style="float:left"> | ||
| <h2>About</h2> | ||
| <ul> | ||
| <li style="list-style-type: none;"><a href="history.html">History</a></li> | ||
| <li style="list-style-type: none;"><a href="employees.html">Employees</a></li> | ||
| <li style="list-style-type: none;"><a href="contact.html">Contact</a></li> | ||
| </ul> | ||
| </nav> | ||
| <main style="float:left; margin-left: 50px;"> | ||
| <h1>Contact us</h1> | ||
| <p>Phone: (541) 754-3010</p> | ||
| <main> | ||
| </body> | ||
| </html> |
This file contains hidden or 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,27 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <title>About - Contact</title> | ||
| </head> | ||
| <body> | ||
| <nav label="main menu" style="text-align: right;"> | ||
| <a href="../about.html">About</a> | ||
| <a href="../admissions.html">Admissions</a> | ||
| <a href="../careers.html">Careers</a> | ||
| </nav> | ||
| <nav label="breadcrumb"><p>You are here: <a href="../admissions.html">Admissions</a> / Contact</p></nav> | ||
| <nav label="submenu" style="float:left"> | ||
| <h2>Admissions</h2> | ||
| <ul> | ||
| <li style="list-style-type: none;"><a href="positions.html">Visit</a></li> | ||
| <li style="list-style-type: none;"><a href="benefits.html">Dates</a></li> | ||
| <li style="list-style-type: none;"><a href="contact.html">Contact</a></li> | ||
| </ul> | ||
| </nav> | ||
| <main style="float:left; margin-left: 50px;"> | ||
| <h1>Contact us</h1> | ||
| <p>Phone: (541) 754-3011</p> | ||
| <main> | ||
| </body> | ||
| </html> |
Oops, something went wrong.
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.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.