Last updated:

Created by:

Success Criterion:

Description

This rule checks that headings describe the topic or purpose of the content.

Accessibility Requirements

This conformance rule relates to:

Test procedure

Applicability

This rule applies to any element with the semantic role of heading that is either visible or included in the accessibility tree.

Note: This rule only applies to elements with the semantic role of heading. Thus, it is a partial check for WCAG 2.0 success criterion 2.4.6, which applies to all headings. “Heading” is used in its general sense and includes headlines and other ways to add a heading to different types of content. This includes elements that are not marked up as headings in the code, but still act visually as headings, e.g. by larger and/or bolder text.

Expectation

Each target element describes the topic or purpose of its section of the content.

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

Assumptions

There are currently no assumptions.

Accessibility Support

There are no major accessibility support issues known for this rule.

Background

Test Cases

Passed

Passed example 1

Heading marked up with h element that describes the topic or purpose of its section of the content.

Code Snippet:
 <h1 class="target">Opening Hours</h1>
<p>We are open Monday through Friday from 10 to 16</p>
 
Example Output: Open in a new tab/ window

Passed example 2

Heading marked up with role="heading" that describes the topic or purpose of its section of the content.

Code Snippet:
 <span role="heading">Opening Hours</span>
<p>We are open Monday through Friday from 10 to 16</p>
 
Example Output: Open in a new tab/ window

Passed example 3

Heading marked up with h element with an image that describes the topic or purpose of its section of the content.

Code Snippet:
 <h1 class="target"><img scr="../test-assets/opening_hours_icon.png" alt="Opening hours"></img></h1>
<p>We are open Monday through Friday from 10 to 16</p>
 
Example Output: Open in a new tab/ window

Passed example 4

Heading marked up with h element that is a single character that describes the topic or purpose of its section of the content.

Code Snippet:
 <h1 class="target">A</h1>
<dl>  
<dt>airplane</dt>
  <dd>a powered flying vehicle with fixed wings and a weight greater than that of the air it displaces.</dd>
 <dt>apple</dt>
  <dd>the round fruit of a tree of the rose family, which typically has thin green or red skin and crisp flesh.</dd>
</dl>
 
Example Output: Open in a new tab/ window

Passed example 5

Heading marked up with role="heading" that describes the topic or purpose of its section of the content. The heading is positioned off screen and is included in the Accessibility Tree.

Code Snippet:
 <span role="heading" style="position: absolute; top: -9999px; left: -9999px;">Opening Hours</span>
<p style="position: absolute; top: -9999px; left: -9999px;">We are open Monday through Friday from 10 to 16</p>
 
Example Output: Open in a new tab/ window

Passed example 6

Heading marked up with h element that describes the topic or purpose of its section of the content. The heading is visible, but is not included in the Accessibility Tree.

Code Snippet:
 <h1 class="target" aria-hidden="true">Opening Hours</h1>
<p>We are open Monday through Friday from 10 to 16</p>
 
Example Output: Open in a new tab/ window

Failed

Failed example 1

Heading marked up with h element that does not describe the topic or purpose of its section of the content.

Code Snippet:
 <h1 class="target">Weather</h1>
<p>We are open Monday through Friday from 10 to 16</p>
 
Example Output: Open in a new tab/ window

Failed example 2

Heading marked up with role="heading" that does not describe the topic or purpose of its section of the content.

Code Snippet:
 <span role="heading">Weather</span>
<p>We are open Monday through Friday from 10 to 16</p>
 
Example Output: Open in a new tab/ window

Failed example 3

Heading marked up with role="heading" that does not describe the topic or purpose of its section of the content. The heading is positioned off screen and is included in the Accessibility Tree.

Code Snippet:
 <span role="heading" style="position: absolute; top: -9999px; left: -9999px;">Weather</span>
<p style="position: absolute; top: -9999px; left: -9999px;">We are open Monday through Friday from 10 to 16</p>
 
Example Output: Open in a new tab/ window

Failed example 4

Heading marked up with h element that does not describe the topic or purpose of its section of the content. The heading is visible, but is not included in the Accessibility Tree.

Code Snippet:
 <h1 class="target" aria-hidden="true">Weather</h1>
<p>We are open Monday through Friday from 10 to 16</p>
 
Example Output: Open in a new tab/ window

Failed example 5

Empty heading marked up with h element.

Code Snippet:
 <h1></h1>
 
Example Output: Open in a new tab/ window

Failed example 6

Empty heading marked up with role="heading".

Code Snippet:
 <p role="heading" level="1"></p>
 
Example Output: Open in a new tab/ window

Inapplicable

Inapplicable example 1

No heading.

Code Snippet:
 <p>We are open Monday through Friday from 10 to 16</p>
 
Example Output: Open in a new tab/ window

Inapplicable example 2

Heading that is neither visible to users, nor included in the accessibility tree.

Code Snippet:
 <h1 style="display: none;">Opening hours</h1>
<p>We are open Monday through Friday from 10 to 16</p>
 
Example Output: Open in a new tab/ window

Glossary

Included in the accessibility tree

Elements included in the accessibility tree of platform specific accessibility APIs. Elements in the accessibility tree are exposed to assistive technologies, allowing users to interact with the elements in a way that meet the requirements of the individual user.

The general rules for when elements are included in the accessibility tree are defined in the core accessibility API mappings. For native markup languages, such as HTML and SVG, additional rules for when elements are [included in the accessibility tree][] can be found in the HTML accessibility API mappings and the SVG accessibility API mappings.

Note: Users of assistive technologies might still be able to interact with elements that are not included in the accessibility tree. An example of this is a focusable element with an aria-hidden attribute with a value of true. Such an element could still be interacted with using sequential keyboard navigation regardless of the assistive technologies used, even though the element would not be included in the accessibility tree.

Semantic Role

A semantic role is a semantic association that indicates an object’s type. This allows tools to present and support interaction with the object in a manner that is consistent with user expectations about other objects of that type.

Roles can be implicit through the element type or explicit through the role attribute.

The role attribute takes a list of tokens. The semantic role is the first valid role in this list. If none of the tokens are valid, the implicit role will be used instead.

Non-abstract roles defined in the following specifications are considered valid:

Other roles may be added as they become available. Not all roles will be supported in all assistive technologies. Testers are encouraged to adjust which roles are allowed according to the accessibility support base line. For the purposes of executing test cases in all rules, it should be assumed that all roles are supported by assistive technologies so that none of the roles fail due to lack of accessibility support.

Note: For HTML elements the implicit roles are documented in ARIA in HTML.

Visible

Content perceivable through sight.

Content is considered visible if making it fully transparent would result in a difference in the pixels rendered for any part of the document that is currently within the viewport or can be brought into the viewport via scrolling.

Content is defined in WCAG.

Section of content

A distinct part or subdivision of a document.

A section of content may consist of one or more paragraphs and include graphics, tables, lists and sub-sections that together serve a purpose.

A section of the content may be defined in different ways, and combinations of these, such as:

  • HTML markup, using WAI-ARIA landmarks or HTML5 sectioning elements.
  • A heading that marks the beginning of the section of content.

Test Aspects

Test aspects are defined as part of the ACT Rules format 1.0.
  • DOM Tree

  • CSS Styling

Contribute






GitHub

Contributing is open to anyone. We welcome any new issues or pull requests for changes. Auto WCAG Rules has conference calls every 4 weeks. If you are interested in becoming an active contributor or reviewer, we ask that you join the Auto WCAG Rules community group through the W3C Website. This requires setting up a W3C account, may require approval by the organization you work for if they are a W3C member.

Learn more about contributing to Auto WCAG Rules Join the Auto WCAG Rules community group now!