Skip to content
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

"Heading is descriptive" (b49b2e): replace "section of content" #1425

Merged
merged 17 commits into from
Sep 23, 2020
Merged
32 changes: 31 additions & 1 deletion _rules/heading-descriptive-b49b2e.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ This rule applies to any element with the [semantic role][] of heading that is e

## Expectation

Each target element describes the topic or purpose of its [section of the content][].
Each target element describes the topic or purpose of the first [palpable content][] which is:

- after the target, in tree order in the [flat tree][]; and
- [visible][], if the target is [visible][]; and
- [included in the accessibility tree][], if the target is [included in the accessibility tree][].
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This strongly suggest that this rule should be split in two, one for each case…

Copy link
Collaborator

@EmmaJP EmmaJP Aug 26, 2020

Choose a reason for hiding this comment

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

Not if those 'and' conditional are intentional. I read this as:

If the target is visible and included in the accessibility tree, then it should describe the first palpable content that is visible and included in the accessibility tree that comes after the target in the flat tree.

However, what about non-visible headings describing visible content, where both are included in the accessibility tree? This is not an unusual use case, eg. a news front page with a hidden heading 'Top headlines'. The heading isn't needed visually as that is usually apparent from other cues.

That also makes me question the phrasing of the applicability. Should it not be ' visible and/or included in the accessibility tree'?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If it is both visible and included in the accessibility tree, then it is "visible or included in the accessibility tree" (the or is inclusive by default). And then it matches both the expectations and need to describe both visible and accessible content (which may be the same or different palpable content).


**Note:** Headings do not need to be lengthy. A word, or even a single character, may suffice.

Expand Down Expand Up @@ -144,6 +148,18 @@ Heading marked up with `h1` element that describes the topic or purpose of its [
</html>
```

### Passed Example 8

This heading describes the first [palpable content][] after it. The next one (the second `p` element) is not considered by this rule.
Jym77 marked this conversation as resolved.
Show resolved Hide resolved

```html
<html lang="en">
<h1>Opening Hours</h1>
<p>We are open Monday through Friday from 10 to 16</p>
<p>We are open Saturday from 10 to 13</p>
</html>
```

### Failed

#### Failed Example 1
Expand Down Expand Up @@ -192,6 +208,18 @@ Heading marked up with `h1` element that does not describe the topic or purpose
</html>
```

### Passed Example 8

This heading does not describe the first [palpable content][] after it. The next one (the second `p` element) is not considered by this rule.
Jym77 marked this conversation as resolved.
Show resolved Hide resolved

```html
<html lang="en">
<h1>Weather</h1>
<p>We are open Monday through Friday from 10 to 16</p>
<p>It is going to rain tomorrow</p>
</html>
```

### Inapplicable

#### Inapplicable Example 1
Expand Down Expand Up @@ -235,7 +263,9 @@ Empty heading marked up with `role="heading"` is not [visible][].
</html>
```

[flat tree]: https://drafts.csswg.org/css-scoping/#flat-tree 'Definition of flat tree'
[included in the accessibility tree]: #included-in-the-accessibility-tree 'Definition of included in the accessibility tree'
[palpable content]: https://html.spec.whatwg.org/multipage/dom.html#palpable-content 'HTML definition of Palpable Content'
[presentational roles conflict resolution]: https://www.w3.org/TR/wai-aria-1.1/#conflict_resolution_presentation_none 'Presentational Roles Conflict Resolution'
[section of the content]: #section-of-content 'Definition of section of content'
[semantic role]: #semantic-role 'Definition of semantic role'
Expand Down