Proposed Test Rule: Document has a landmark with non-repeated content
Description
This rule checks that each page has an element with a landmark semantic role starting with non-repeated content
Applicability
This rule applies to any HTML web page.
Expectations
Within each test target, either there is no non-repeated content after repeated content or there exists an element for which all the following are true:
- the element has [semantic role][] inheriting from
landmark
; and - the first perceivable content (in [tree order][] in the flat tree) which is an inclusive descendant of the element is non-repeated content after repeated content; and
- the element is included in the accessibility tree.
Assumptions
- This rule assumes that landmarks are intended to users of Assistive Technologies and are not necessarily rendered in a visible way. Therefore, it does not require the main landmark to be [visible][]. Similarly, technique [ARIA11: Using ARIA landmarks to identify regions of a page][tech aria11] does not require landmarks to be [visible][] or have [visible][] content.
Accessibility Support
Marking content with landmarks is sufficient to pass [Success Criterion 2.4.1 Bypass blocks][sc241]. However, this will only benefit users who can actually navigate using landmark roles (such a functionality is usually provided by assistive technologies, but could also be provided by browsers or browsers plugins). Users without any possibility for landmarks navigation will be left without way of bypassing blocks of repeated content and will still experience accessibility issues. Therefore, it is recommended to provide other ways of bypassing blocks.
Background
Most of the time, this rule passes by enclosing the primary content of the page in a main
landmark.
[Technique ARIA11: Using ARIA landmarks to identify regions of a page][tech aria11] only checks that landmarks are correctly used, but does not check whether landmarks could have been used and were omitted. Therefore, failing this rule (not having enough landmarks) does not necessarily fail that technique, and it is not listed as an accessibility mapping.
- [Technique ARIA11: Using ARIA landmarks to identify regions of a page][tech aria11]
- ARIA Landmarks Example
- CSS scoping (work in progress)
- The
main
role
In most examples, the nav
element is a block of repeated content.
Test Cases
Passed
Passed Example 1
In this document, the main
element has a [semantic role][] of main
and is included in the accessibility tree.
<html>
<head>
<title>The Three Kingdoms, Chapter 1</title>
</head>
<body>
<nav id="chapters-navigation">
<ol>
<li><a>Chapter 1</a></li>
<li><a href="/test-assets/bypass-blocks-cf77f2/chapter2.html">Chapter 2</a></li>
</ol>
</nav>
<main>
<p>
Unity succeeds division and division follows unity. One is bound to be replaced by the other after a long span
of time.
</p>
</main>
</body>
</html>
Passed Example 2
In this document the div
element has a [semantic role][] of main
and is included in the accessibility tree.
<html>
<head>
<title>The Three Kingdoms, Chapter 1</title>
</head>
<body>
<nav id="chapters-navigation">
<ol>
<li><a>Chapter 1</a></li>
<li><a href="/test-assets/bypass-blocks-cf77f2/chapter2.html">Chapter 2</a></li>
</ol>
</nav>
<div role="main">
<p>
Unity succeeds division and division follows unity. One is bound to be replaced by the other after a long span
of time.
</p>
</div>
</body>
</html>
Passed Example 3
This document has several elements with a role of main
, at least one of them is included in the accessibility tree.
<html>
<head>
<title>Comparing translations of the Romance of the Three Kingdoms, Chapter one</title>
</head>
<body>
<nav id="chapters-navigation">
<ol>
<li><a>Chapter 1</a></li>
<li><a href="/test-assets/bypass-blocks-cf77f2/chapter2.html">Chapter 2</a></li>
</ol>
</nav>
<main aria-label="Translation by Charles Henry Brewitt-Taylor (1925)" aria-hidden="true">
<p>
The world under heaven, after a long period of division, tends to unite; after a long period of union, tends to
divide.
</p>
</main>
<main aria-label="Translation by Moss Roberts (1976)">
<p>The empire, long divided, must unite; long united, must divide. Thus it has ever been.</p>
</main>
<main aria-label="Translation by Yu Sumei (2014)" aria-hidden="true">
<p>
Unity succeeds division and division follows unity. One is bound to be replaced by the other after a long span
of time.
</p>
</main>
</body>
</html>
Passed Example 4
This document has no non-repeated content after repeated content.
<html>
<head>
<title>The Three Kingdoms, Chapter 1</title>
</head>
<body>
<p>
Unity succeeds division and division follows unity. One is bound to be replaced by the other after a long span of
time.
</p>
</body>
</html>
Failed
Failed Example 1
This document has no element with a landmark role.
<html>
<head>
<title>The Three Kingdoms, Chapter 1</title>
</head>
<body>
<div id="chapters-navigation">
<ol>
<li><a>Chapter 1</a></li>
<li><a href="/test-assets/bypass-blocks-cf77f2/chapter2.html">Chapter 2</a></li>
</ol>
</div>
<p>
Unity succeeds division and division follows unity. One is bound to be replaced by the other after a long span of
time.
</p>
</body>
</html>
Failed Example 2
This document has no element with a landmark role after its repeated content. The element with a landmark role does not contain any non-repeated content after repeated content.
<html>
<head>
<title>The Three Kingdoms, Chapter 1</title>
</head>
<body>
<nav id="chapters-navigation">
<ol>
<li><a>Chapter 1</a></li>
<li><a href="/test-assets/bypass-blocks-cf77f2/chapter2.html">Chapter 2</a></li>
</ol>
</nav>
<p>
Unity succeeds division and division follows unity. One is bound to be replaced by the other after a long span of
time.
</p>
</body>
</html>
Failed Example 3
This document has a main
landmark, but it is not included in the accessibility tree.
<html>
<head>
<title>The Three Kingdoms, Chapter 1</title>
</head>
<body>
<nav id="chapters-navigation">
<ol>
<li><a>Chapter 1</a></li>
<li><a href="/test-assets/bypass-blocks-cf77f2/chapter2.html">Chapter 2</a></li>
</ol>
</nav>
<main aria-hidden="true">
<p>
Unity succeeds division and division follows unity. One is bound to be replaced by the other after a long span
of time.
</p>
</main>
</body>
</html>
Inapplicable
Inapplicable Example 1
This document is not an HTML web page.
<svg xmlns="http://www.w3.org/2000/svg">
<title>This is an SVG</title>
</svg>
Glossary
Block of content
A block of content in an HTML web page is a set of nodes from that page for which all the following are true:
- content: there is at least one node which is perceivable content in the block; and
- continuity: if two nodes are in the block, then any node between them (in tree order) is also in the block; and
- downward closure: if a node is in the block, then all its descendants are also in the block; and
- parent closure: if all children of a node are in the block, then this node is also in the block.
Block of repeated content
A block of content B, inside an HTML web page P, is a block of repeated content if both the following are true:
- distance 1: there exist an instrument in P which leads the user to another HTML web page P’ whose URL has a different host, port (including default port for [special URL][]), or path; and
- repeated: there exist a block of content in P’ which is equivalent to B.
Equivalent resource
Non-identical resources can still be equivalent resources 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 separate links, the resources are not equivalent.
Explicit Semantic Role
The explicit semantic role of an element is determined by its role attribute (if any).
The role attribute takes a list of tokens. The explicit semantic role is the first valid role in this list. The valid roles are all non-abstract roles from [WAI-ARIA Specifications][]. If the element has no role attribute, or if it has one with no valid role, then this element has no explicit semantic role.
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.
Focusable
Elements that can become the target of keyboard input as described in the HTML specification of focusable and can be focused.
Hidden State
An HTML element’s hidden state is “true” if at least one of the following is true for itself or any of its ancestors in the flat tree:
- has a
hidden
attribute; or - has a computed CSS property
display
ofnone
; or - has a computed CSS property
visibility
ofhidden
; or - has an
aria-hidden
attribute set totrue
In any other case, the element’s hidden state is “false”.
Implicit Semantic Role
The implicit semantic role of an element is a pre-defined value given by the host language which depends on the element and its ancestors.
Implicit roles for HTML and SVG, are documented in the HTML accessibility API mappings (working draft) and the SVG accessibility API mappings (working draft).
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 (working draft) and the SVG accessibility API mappings (working draft).
For more details, see [examples of included in the accessibility tree][].
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 using sequential keyboard navigation regardless of the assistive technologies used, even though the element would not be included in the accessibility tree.
[examples of included in the accessibility tree]: https://act-rules.github.io/pages/examples/included-in-the-accessibility-tree/
Instrument to achieve an objective
An HTML element that when activated allows an end-user to achieve an objective.
Note: Any rule that uses this definition must provide an unambiguous description of the objective the instrument is used to achieve.
Marked as decorative
An element is marked as decorative if one or more of the following conditions is true:
- it has an explicit role of
none
orpresentation
; or - it is an
img
element with analt
attribute whose value is the empty string (alt=""
), and with no explicit role.
Elements are marked as decorative as a way to convey the intention of the author that they are pure decoration. It is different from the element actually being pure decoration as authors may make mistakes. It is different from the element being effectively ignored by assistive technologies as rules such as presentational roles conflict resolution may overwrite this intention.
Elements can also be ignored by assistive technologies if their hidden state is true. This is different from marking the element as decorative and does not convey the same intention. Notably, the hidden state of an element may change as users interact with the page (showing and hiding elements) while being marked as decorative should stay the same through all states of the page.
Non-repeated content after repeated content
A node is non-repeated content after repeated content if all the following are true:
- the node is perceivable content; and
- the node is not part of any block of repeated content; and
- the node is after (in [tree order][] in the flat tree) at least one block of repeated content.
Outcome
An outcome is a conclusion that comes from evaluating an ACT Rule on a test subject or one of its constituent test target. An outcome can be one of the three following types:
- Inapplicable: No part of the test subject matches the applicability
- Passed: A test target meets all expectations
- Failed: A test target does not meet all expectations
Note: A rule has one passed
or failed
outcome for every test target. When there are no test targets the rule has one inapplicable
outcome. This means that each test subject will have one or more outcomes.
Note: Implementations using the EARL10-Schema can express the outcome with the outcome property. In addition to passed
, failed
and inapplicable
, EARL 1.0 also defined an incomplete
outcome. While this cannot be the outcome of an ACT Rule when applied in its entirety, it often happens that rules are only partially evaluated. For example, when applicability was automated, but the expectations have to be evaluated manually. Such “interim” results can be expressed with the incomplete
outcome.
Perceivable content
A node is perceivable content if all the following are true:
- the node is palpable content; and
- the node is either [visible][] or included in the accessibility tree; and
- if the node is an element, it does not have a [semantic role][] of
none
orpresentation
.
Perceivable content corresponds to nodes that contain information and are perceived by some categories of users.
Semantic Role
The semantic role of an element is determined by the first of these cases that applies:
- Conflict If the element is marked as decorative, but the element is included in the accessibility tree; or would be included in the accessibility tree when its hidden state is false, then its semantic role is its implicit role.
- Explicit If the element has an explicit role, then its semantic role is its explicit role.
- Implicit The semantic role of the element is its implicit role.
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.
For more details, see examples of visible.
WAI-ARIA specifications
The WAI ARIA Specifications group both the WAI ARIA W3C Recommendation and ARIA modules, namely:
- Accessible Rich Internet Applications (WAI-ARIA) 1.1
- WAI-ARIA Graphics Module 1.0
- Digital Publishing WAI-ARIA Module 1.0
Note: depending on the type of content being evaluated, part of the specifications might be irrelevant and should be ignored.
Web page (HTML)
An HTML web page is the set of all fully active documents which share the same top-level browsing context.
Note: Nesting of browsing context mostly happens with iframe
and object
. Thus a web page will most of the time be a “top-level” document and all its iframe
and object
(recursively).
Note: Web pages as defined by WCAG are not restricted to the HTML technology but can also include, e.g., PDF or DOCX documents.
Note: Although web pages as defined here are sets of documents (and do not contain other kind of nodes), one can abusively write that any node is “in a web page” if it is a shadow-including descendant of a document that is part of that web page.
Implementations
This section is not part of the official rule. It is populated dynamically and not accounted for in the change history or the last modified date.
Implementation | Consistency | Complete | Report |
---|---|---|---|
QualWeb | Consistent | Yes | View Report |
Changelog
This is the first version of this ACT rule.
[sc131]: https://www.w3.org/TR/WCAG21/#info-and-relationships ‘Success Criterion 1.3.1 [sc211]: https://www.w3.org/TR/WCAG21/#keyboard ‘Success Criterion 2.1.1 Keyboard’ [sc241]: https://www.w3.org/TR/WCAG21/#bypass-blocks ‘Success Criterion 2.4.1 Bypass Blocks’ [sc412]: https://www.w3.org/TR/WCAG21/#name-role-value ‘Success Criterion 4.1.2 Name, Role, Value’ [semantic role]: #semantic-role ‘Definition of Semantic Role’ [special url]: https://url.spec.whatwg.org/#is-special ‘URL specification of Special URL’ [tech aria11]: https://www.w3.org/WAI/WCAG21/Techniques/aria/ARIA11 ‘Technique ARIA11 [tree order]: https://dom.spec.whatwg.org/#concept-tree-order ‘DOM specification of Tree Order’ [visible]: #visible ‘Definition of Visible’ [wai-aria specifications]: #wai-aria-specifications ‘Definition of WAI-ARIA specifications’