SIA-R59Documents have headings

Accessibility requirements

This rule is not required for conformance to any accessibility requirements.

Description

This rule checks that documents have headings.

Applicability

This rule applies to every document where the document element is an <html> element in the HTML namespace.

Expectations

  1. The document has at least one descendant in the flat tree that is an element in the HTML namespace with a semantic role of heading.

Assumptions

This rule makes no assumptions.

Accessibility support

This rule has no known accessibility support concerns.

Examples

Passed

This document has a <h1> element, whose implicit role is heading.

<html>
    <h1>This is a heading</h1>
</html>

This document has a <div> element, whose explicit role is set to heading.

<html>
    <div role="heading" aria-level="1">This is a heading</div>
</html>

This document has several heading elements of different level.

<html>
    <h1>This is a heading</h1>
    <h2>This is a sub-heading</h2>
    <h2>This is another sub-heading</h2>
</html>

This document has several heading elements, nested inside a <hgroup> element.

<html>
    <hgroup>
        <h1>This is a heading</h1>
        <h1>This is an alternate heading</h1>
    </hgroup>
</html>

Failed

This document has no element with a semantic role of heading.

<html>
    <div>This is not a heading</div>
</html>

The <hgroup> element itself does not have an implicit role of heading. Hence, this document has no element with a semantic role of heading.

<html>
    <hgroup>
        <div>This is not a heading</div>
    </hgroup>
</html>

Inapplicable

In this document, the document element is an SVG <svg> element, not an HTML <html> element, hence the rule is inapplicable.

<svg xmlns="http://www.w3.org/2000/svg">
  <title>This is a circle</title>
  <circle cx="150" cy="75" r="50" fill="green"></circle>
</svg>