Skip to content

Consider accessible description in the rules that use link context (5effbb, fd3a94) #1845

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

Open
wants to merge 26 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1746bf8
Update links-with-identical-names-and-context-serve-equivalent-purpos…
carlosapaduarte May 13, 2022
2d271ab
Update link-in-context-descriptive-5effbb.md
carlosapaduarte May 13, 2022
0b07c9d
Merge branch 'develop' into include-title-attribute-in-link-context
carlosapaduarte May 19, 2022
3bf682f
Merge branch 'develop' into include-title-attribute-in-link-context
carlosapaduarte May 30, 2022
1f6fcd2
Merge branch 'develop' into include-title-attribute-in-link-context
carlosapaduarte Jun 3, 2022
1918c30
Update _rules/link-in-context-descriptive-5effbb.md
carlosapaduarte Jun 3, 2022
bc72adf
Remove aria-describedby from the programmatically determined link con…
carlosapaduarte Jun 3, 2022
0a576aa
update example description
carlosapaduarte Jun 3, 2022
637c43c
fix order of headings
carlosapaduarte Jun 3, 2022
8df5b30
Update _rules/links-with-identical-names-and-context-serve-equivalent…
carlosapaduarte Jun 6, 2022
b52c6f3
Update _rules/links-with-identical-names-and-context-serve-equivalent…
carlosapaduarte Jun 6, 2022
8b23479
Update _rules/links-with-identical-names-and-context-serve-equivalent…
Jan 4, 2023
16dfe6b
add definition of accessible description
carlosapaduarte Jan 4, 2023
7986cd1
use definition of accessible description
carlosapaduarte Jan 4, 2023
6b141c4
use definition of accessible description
carlosapaduarte Jan 4, 2023
a7f9cec
add example with aria-describedby
carlosapaduarte Jan 4, 2023
29c31b0
Changes from review
carlosapaduarte Feb 8, 2023
1bd8c51
Merge branch 'develop' into include-title-attribute-in-link-context
Feb 8, 2023
91fb0bc
Merge branch 'develop' into include-title-attribute-in-link-context
Mar 3, 2023
4870c48
Apply suggestions from code review
Sep 14, 2023
b32d0b6
Merge branch 'develop' into include-title-attribute-in-link-context
Sep 14, 2023
d1d7cfe
Merge branch 'develop' into include-title-attribute-in-link-context
Jan 24, 2024
3ff697a
Merge branch 'develop' into include-title-attribute-in-link-context
Feb 1, 2024
47f5b1a
Update link-in-context-descriptive-5effbb.md
Feb 1, 2024
b664ffb
Merge branch 'develop' into include-title-attribute-in-link-context
carlosapaduarte Feb 6, 2025
6260db4
Fix repeated inapplicable example number
carlosapaduarte Jun 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 32 additions & 7 deletions _rules/link-in-context-descriptive-5effbb.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ This rule applies to any [inheriting semantic][] `link` for which all the follow

## Expectation

The [accessible name][] of each target element together with its [programmatically determined link context][] describes the purpose of the link.
The [accessible name][] of each target element together with its [accessible description][] and [programmatically determined link context][] describes the purpose of the link.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is obviously correct. The SC talks about link text and programmatically determined context. Its probably worth putting in the assumption that we're using "link text" from WCAG to mean accessible name and description. Links that fail label in name could have visible text that isn't considered "link text" in this rule. I think that should be in the assumption.


## Background

Expand All @@ -46,6 +46,8 @@ The [accessible name][] of each target element together with its [programmatical

- This rule assumes that all [semantic][semantic role] `link` elements are used as links. An element marked up as a link, but that does not behave as a link would not fail success criteria [2.4.4 Link Purpose (In Context)][sc244] or [2.4.9 Link Purpose (Link only)][sc249].

- This rule assumes that "link text" as referred to in WCAG encompasses both the [accessible name][] and [description][accessible description] of the target element.

### Accessibility Support

- Implementation of [Presentational Roles Conflict Resolution][] varies from one browser or assistive technology to another. Depending on this, some [semantic][semantic role] `link` elements can fail this rule with some technology but users of other technologies would not experience any accessibility issue.
Expand Down Expand Up @@ -98,6 +100,28 @@ The [accessible name][] describes the purpose of the link.

#### Passed Example 3

The [accessible name][] together with the [accessible description][] describes the purpose of the link.

```html
<a href="#desc" title="See the product's description">More</a>

<p id="desc">This product consists of several web pages.</p>
```

#### Passed Example 4

The [accessible name][] together with the [accessible description][] describes the purpose of the link.

```html
<a href="#desc" aria-describedby="link-desc">More</a>

<p id="link-desc" style="display: none">See the product's description.</p>

<p id="desc">This product consists of several web pages.</p>
```

#### Passed Example 5

The [accessible name][] (from the link's text), together with its [programmatically determined link context][] (available from the text in the closest `p` ancestor), describes the purpose of the link.

```html
Expand All @@ -106,7 +130,7 @@ The [accessible name][] (from the link's text), together with its [programmatica
<p id="desc">This product consists of several web pages.</p>
```

#### Passed Example 4
#### Passed Example 6

The [accessible name][] (from the link's text) describes the purpose of the link.

Expand All @@ -116,7 +140,7 @@ The [accessible name][] (from the link's text) describes the purpose of the link
<p id="desc">This product consists of several web pages.</p>
```

#### Passed Example 5
#### Passed Example 7

The [programmatically determined link context][] (provided by the ancestor with a role of `listitem` and text "Ulysses") and the [accessible name][] (from the link's text) describe the purpose of the links.

Expand All @@ -137,7 +161,7 @@ The [programmatically determined link context][] (provided by the ancestor with
</ul>
```

#### Passed Example 6
#### Passed Example 8

The [programmatically determined link context][] (provided by the table header [assigned](https://html.spec.whatwg.org/multipage/tables.html#algorithm-for-assigning-header-cells) to the cell containing the link) and the [accessible name][] (from the link's text) describe the purpose of the links.

Expand All @@ -158,7 +182,7 @@ The [programmatically determined link context][] (provided by the table header [
</table>
```

#### Passed Example 7
#### Passed Example 9

The [accessible name][] describes the purpose of the link.

Expand All @@ -180,7 +204,7 @@ The [accessible name][] describes the purpose of the link.
</main>
```

#### Passed Example 8
#### Passed Example 10

The [programmatically determined link context][] (provided by the cell containing the link) and the [accessible name][] (from the link's text) describe the purpose of the links.

Expand All @@ -201,7 +225,7 @@ The [programmatically determined link context][] (provided by the cell containin
</table>
```

#### Passed Example 9
#### Passed Example 11

The [programmatically determined link context][] (provided by the element referenced by the `aria-describedby` attribute) and the [accessible name][] (from the link's text) describe the purpose of the links.

Expand Down Expand Up @@ -339,6 +363,7 @@ This `a` element is not a [semantic][semantic role] `link`, because it has no `h
```

[accessible name]: #accessible-name 'Definition of Accessible Name'
[accessible description]: #accessible-description 'Definition of Accessible Description'
[included in the accessibility tree]: #included-in-the-accessibility-tree 'Definition of Included in the Accessibility Tree'
[presentational roles conflict resolution]: https://www.w3.org/TR/wai-aria-1.2/#conflict_resolution_presentation_none 'Presentational Roles Conflict Resolution'
[programmatically determined link context]: #programmatically-determined-link-context 'Definition of Programmatically Determined Link Context'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ This rule applies to any set of two or more [HTML or SVG elements][] for which a
- the elements are in the same [web page (HTML)][]; and
- the elements are [included in the accessibility tree][included in the accessibility tree]; and
- the elements have [matching][] [accessible names][accessible name] that are not empty (`""`); and
- the elements have the same [programmatically determined link context][].
- the elements have [matching][] [accessible descriptions][accessible description]; and
- have the same [programmatically determined link context][].

**Note:** The test target for this rule is the full set of link elements that share the same [matching][] [accessible name][] and [programmatically determined link context][].
**Note:** The test target for this rule is the full set of link elements that share the same [matching][] [accessible name][], [accessible description][] and [programmatically determined link context][].

## Expectation

Expand Down Expand Up @@ -84,7 +85,7 @@ There are no accessibility support issues known.

#### Passed Example 1

These two HTML `a` elements have the same [accessible name][] and [context][programmatically determined link context] and link to the [same resource][].
These two HTML `a` elements have the same non-empty [accessible name][], empty [accessible description][], the same [context][programmatically determined link context], and resolve to the [same resource][].

```html
<html lang="en">
Expand All @@ -98,7 +99,7 @@ These two HTML `a` elements have the same [accessible name][] and [context][prog

#### Passed Example 2

These two HTML `a` elements have the same [accessible name][] and [context][programmatically determined link context], and resolve to the [same resource][] after an instant redirect.
These two HTML `a` elements have the same non-empty [accessible name][], empty [accessible description][], the same [context][programmatically determined link context], and resolve to the [same resource][] after an instant redirect.

```html
<html lang="en">
Expand All @@ -113,7 +114,7 @@ These two HTML `a` elements have the same [accessible name][] and [context][prog

#### Passed Example 3

These two HTML `a` elements have the same [accessible name][] and [context][programmatically determined link context], and resolve to identical resources.
These two HTML `a` elements have the same non-empty [accessible name][], empty [accessible description][], the same [context][programmatically determined link context], and resolve to identical resources.

```html
<html lang="en">
Expand All @@ -129,7 +130,7 @@ These two HTML `a` elements have the same [accessible name][] and [context][prog

#### Passed Example 4

These two HTML `a` elements have the same [accessible name][] and [context][programmatically determined link context], and resolve to pages that serve the same purpose because the content section is the same.
These two HTML `a` elements have the same [accessible name][], empty [accessible description][], the same [context][programmatically determined link context], and resolve to pages that serve the same purpose because the content section is the same.

```html
<html lang="en">
Expand All @@ -145,7 +146,7 @@ These two HTML `a` elements have the same [accessible name][] and [context][prog

#### Passed Example 5

These two HTML `a` elements have the same [accessible name][] and [context][programmatically determined link context], and go to pages that fulfill the same purpose in relation to the link because they contain the same relevant information.
These two HTML `a` elements have the same [accessible name][], empty [accessible description][], the same [context][programmatically determined link context], and go to pages that fulfill the same purpose in relation to the link because they contain the same relevant information.

```html
<html lang="en">
Expand All @@ -160,7 +161,7 @@ These two HTML `a` elements have the same [accessible name][] and [context][prog

#### Passed Example 6

These two HTML `a` elements have the same [accessible name][] and [context][programmatically determined link context], and go to pages that use different layouts but have the same purpose.
These two HTML `a` elements have the same [accessible name][], empty [accessible description][], the same [context][programmatically determined link context], and go to pages that use different layouts but have the same purpose.

```html
<html lang="en">
Expand All @@ -176,7 +177,7 @@ These two HTML `a` elements have the same [accessible name][] and [context][prog

#### Passed Example 7

These two HTML `span` elements have an [explicit role][] of link, the same [accessible name][], the same [context][programmatically determined link context], and link to the [same resource][].
These two HTML `span` elements have an [explicit role][] of link, the same [accessible name][], empty [accessible description][], the same [context][programmatically determined link context], and link to the [same resource][].

```html
<html lang="en">
Expand All @@ -202,7 +203,7 @@ These two HTML `span` elements have an [explicit role][] of link, the same [acce

#### Passed Example 8

These two SVG `a` and HTML `a` elements have the same [accessible name][], same [context][programmatically determined link context] and link to the [same resource][].
These two SVG `a` and HTML `a` elements have the same [accessible name][], empty [accessible description][], same [context][programmatically determined link context] and link to the [same resource][].

```html
<html lang="en">
Expand All @@ -220,7 +221,7 @@ These two SVG `a` and HTML `a` elements have the same [accessible name][], same

#### Passed Example 9

These two HTML `a` elements have the same [accessible name][] and [context][programmatically determined link context], but resolve to different resources. However, the purpose of these links is [ambiguous to users in general](https://www.w3.org/TR/WCAG22/#dfn-ambiguous-to-users-in-general). Thus all readers are unsure about the destination and the person with a disability is not at any disadvantage.
These two HTML `a` elements have the same [accessible name][], the same [accessible description][], and the same [context][programmatically determined link context], but go to different resources. However, there is no visual information to let users know that both links resolve to non-equivalent resources.

```html
<html lang="en">
Expand Down Expand Up @@ -256,7 +257,7 @@ These two HTML `a` elements have the same [accessible name][] and are nested wit

#### Failed Example 2

These two HTML `a` elements have the same [accessible name][] and [context][programmatically determined link context], but go to different resources.
These two HTML `a` elements have the same [accessible name][], the same [accessible description][] and [context][programmatically determined link context]. They link to web pages that are similar, but have different information in their content.

```html
<html lang="en">
Expand Down Expand Up @@ -400,7 +401,7 @@ These two SVG `a` elements have the same [accessible name][] and [context][progr

#### Failed Example 8

These two HTML `a` elements with the same [accessible name][] and [context][programmatically determined link context] resolve to the [same resource][] after redirect, but the redirect is not instant.
These two HTML `a` elements with the same [accessible name][], the same [accessible description][], and the same [context][programmatically determined link context], resolve to the [same resource][] after redirect, but the redirect is not instant.

```html
<html lang="en">
Expand Down Expand Up @@ -448,7 +449,28 @@ These two HTML `a` elements have different [accessible names][accessible name].

#### Inapplicable Example 3

These two HTML `a` elements have the same [accessible name][] and link to the [same resource][] but different [programmatically determined link contexts][programmatically determined link context].
These two HTML `a` elements have the same [accessible names][accessible name] but different [accessible descriptions][accessible description].

```html
<html lang="en">
<p>
<a
href="/test-assets/links-with-identical-names-serve-equivalent-purpose-b20e66/about/contact.html"
title="To learn more about us"
>Contact</a
>
<a
href="/test-assets/links-with-identical-names-serve-equivalent-purpose-b20e66/about/contact.html"
title="To know how to reach us"
>Contact</a
>
</p>
</html>
```

#### Inapplicable Example 4

These two HTML `a` elements have the same [accessible name][], , the same [accessible description][], and link to the [same resource][] but different [programmatically determined link contexts][programmatically determined link context].

```html
<html lang="en">
Expand All @@ -465,7 +487,7 @@ These two HTML `a` elements have the same [accessible name][] and link to the [s
</html>
```

#### Inapplicable Example 4
#### Inapplicable Example 5

These two `span` elements do not have a [semantic role][] of link.

Expand All @@ -483,9 +505,9 @@ These two `span` elements do not have a [semantic role][] of link.
</html>
```

#### Inapplicable Example 5
#### Inapplicable Example 6

These two HTML `a` elements have the same [accessible name][] and link to the [same resource][] but different [programmatically determined link contexts][programmatically determined link context]. Even though the two contexts in this example are _identical_, they are not the _same_. That is: even though they have equivalent content, they do not consist of the same DOM elements.
These two HTML `a` elements have the same [accessible name][], the same [accessible description][], and link to the [same resource][] but different [programmatically determined link contexts][programmatically determined link context]. Even though the two contexts in this example are *identical*, they are not the *same*. That is: even though they have equivalent content, they do not consist of the same DOM elements.

```html
<html lang="en">
Expand All @@ -500,16 +522,16 @@ These two HTML `a` elements have the same [accessible name][] and link to the [s
</html>
```

#### Inapplicable Example 6
#### Inapplicable Example 7

These two HTML `a` elements have the same [accessible name][] but different [programmatically determined link contexts][programmatically determined link context] because the `div` elements place them in different display blocks.
These two HTML `a` elements have the same [accessible name][], the same [accessible description][], but different [programmatically determined link contexts][programmatically determined link context] because the `div` elements place them in different display blocks.

```html
<div><a href="https://www.w3.org/WAI/">Read more</a> about the W3C WAI</div>
<div><a href="https://www.w3.org/International/">Read more</a> about the W3C internationalization</div>
```

#### Inapplicable Example 7
#### Inapplicable Example 8

These two HTML `a` elements have the same [accessible name][] and [context][programmatically determined link context], but the second one is not [included in the accessibility tree][included in the accessibility tree].

Expand All @@ -524,6 +546,7 @@ These two HTML `a` elements have the same [accessible name][] and [context][prog
```

[accessible name]: #accessible-name 'Definition of accessible name'
[accessible description]: #accessible-description 'Definition of Accessible Description'
[document]: https://dom.spec.whatwg.org/#concept-document 'Definition of document'
[equivalent resource]: #equivalent-resource 'Definition of Equivalent Resource'
[explicit role]: #explicit-role 'Definition of explicit role'
Expand Down
21 changes: 21 additions & 0 deletions pages/glossary/accessible-description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: Accessible Description
key: accessible-description
unambiguous: true
objective: true
input_aspects:
- Accessibility tree
- CSS styling
- DOM tree
---

The _accessible description_ is the programmatically determined description of a user interface element that is [included in the accessibility tree](#included-in-the-accessibility-tree). The accessible description provides information that complements the [accessible name][].
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never noticed that our def of "accessible name" is only for "UI element" 🤔 Feels a bit weird or restrictive (and maybe ambiguous since we usually use "instrument"). Again not related to this PR.


The accessible description 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 description can be found in [HTML Accessibility API Mappings 1.0, Accessible Name and Description Computation (working draft)](https://www.w3.org/TR/html-aam/#accessible-name-and-description-computation) and [SVG Accessibility API Mappings, Name and Description (working draft)](https://www.w3.org/TR/svg-aam/#mapping_additional).

**Note:** As per the [accessible name and description computation][], each element with the 'aria-describedby' property always has an accessible description.

[accessible name]: #accessible-name 'Definition of Accessible Name'
[accessible name and description computation]: https://www.w3.org/TR/accname 'Accessible Name and Description Computation'
3 changes: 1 addition & 2 deletions pages/glossary/programmatically-determined-link-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ The _programmatically determined context_ of a link (or _programmatically determ
- being an [ancestor][] of the link in the [flat tree][] with a [semantic role][] of `listitem`; or
- being the closest [ancestor][] of the link in the [flat tree][] that generates a [block container][]; or
- being the closest [ancestor][] of the link in the [flat tree][] that has a [semantic role][] of `cell` or `gridcell`; or
- being a header cell [assigned][] to the closest [ancestor][] of the link in the [flat tree][] that has a [semantic role][] of `cell` or `gridcell`; or
- being referenced by an `aria-describedby` attribute of the link.
- being a header cell [assigned][] to the closest [ancestor][] of the link in the [flat tree][] that has a [semantic role][] of `cell` or `gridcell`.

This definition is based on (but not equivalent to) the [WCAG definition of programmatically determined link context](https://www.w3.org/TR/WCAG22/#dfn-programmatically-determined-link-context).

Expand Down