Skip to content

Proposed Block of repeated content is collapsible

Description

This rule checks that repeated blocks of content are collapsible

Applicability

This rule applies to any HTML web page.

Expectation

For each block of repeated content in each test target, which is before (in the flat tree) at least one node of non-repeated content after repeated content, all the following are true:

Assumptions

There are no assumptions.

Accessibility Support

There are no accessibility support issues known.

Background

Usually the same instrument removes both visibility and inclusion in the accessibility tree of a block of repeated content. That instrument may remove all blocks of repeated content. If there is no block of repeated content before the non-repeated content the rule passes.

Technique SCR28: Using an expandable and collapsible menu to bypass block of content does not have any requirements concerning the location of the instruments in relation to the block of repeated content they control, hence this rule doesn’t. It is likely a good idea to either keep each instrument close to the start of the block of repeated content it controls; or to group them all in one place near the start of the document. Notably, instruments located after (in reading order) the block they collapse are likely not satisfying Success Criterion 2.4.1 Bypass blocks, which this rule is designed for. Thus, it is possible to pass this rule without satisfying Success Criterion 2.4.1 Bypass blocks.

Bibliography

Accessibility Requirements Mapping

Input Aspects

The following aspects are required in using this rule.

Test Cases

These HTML, Javascript, and CSS files are used in several examples:

File /test-assets/bypass-blocks-cf77f2/chapter2.html:

<html>
	<head>
		<title>The Three Kingdoms, Chapter 2</title>
	</head>
	<body>
		<nav id="chapters-navigation">
			<h1>Content</h1>
			<ol>
				<li><a href="/test-assets/bypass-blocks-cf77f2/chapter1.html">Chapter 1</a></li>
				<li><a>Chapter 2</a></li>
			</ol>
		</nav>

		<aside id="bio-translator">
			<h1>About the translator</h1>
			<p>Yu Sumei is a professor of English at East China Normal University.</p>
		</aside>
		<aside id="about-book">
			<h1>About the book</h1>
			<p>The Romance of the Three Kingdoms is a 14th century historical novel.</p>
		</aside>

		<main>
			<h1>Zhang Fei Trashes the Inspector in Wrath</h1>
			<p>
				Now this Dong Zhuo, also known as Dong Zhong-ying, was from Lintao in northwest China.
			</p>
		</main>
	</body>
</html>

File /test-assets/bypass-blocks-cf77f2/toggle-display.js:

function toggleHidden(...ids) {
	ids.forEach(id => {
		const element = document.getElementById(id)
		element.style.display = element.style.display === 'none' ? '' : 'none'
	})
}

function hide(id) {
	const element = document.getElementById(id)
	element.style.display = 'none'
}

function show(id) {
	const element = document.getElementById(id)
	element.style.display = ''
}

function toggleVisibility(id) {
	const element = document.getElementById(id)
	element.className = element.className === 'off-screen' ? '' : 'off-screen'
}

function toggleAriaHidden(id) {
	const element = document.getElementById(id)
	element.setAttribute('aria-hidden', (element.getAttribute('aria-hidden') !== 'true').toString())
}

File /test-assets/bypass-blocks-cf77f2/styles.css:

.off-screen {
	position: absolute;
	top: -999px;
}

.visible-on-focus {
	position: absolute;
	top: -100px;
}
.visible-on-focus:focus-within {
	position: relative;
	top: 0px;
}

Passed

Passed Example 1

Open in a new tab

This document has a link at the start of the document to toggle the visibility and inclusion in the accessibility tree of the navigational block of repeated content.

<html>
	<head>
		<script src="/test-assets/bypass-blocks-cf77f2/toggle-display.js"></script>
		<title>The Three Kingdoms, Chapter 1</title>
	</head>
	<body>
		<a href="#" onclick="toggleHidden('chapters-navigation')">Toggle table of content</a>

		<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 id="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 2

Open in a new tab

This document has a button at the start of the document to toggle the visibility and inclusion in the accessibility tree of both the complementary and the navigational blocks of repeated content.

<html>
	<head>
		<script src="/test-assets/bypass-blocks-cf77f2/toggle-display.js"></script>
		<title>The Three Kingdoms, Chapter 1</title>
	</head>
	<body>
		<button onclick="toggleHidden('chapters-navigation', 'about-book')">Toggle repeated content</button>

		<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>

		<aside id="about-book">
			<p>The Romance of the Three Kingdoms is a 14th century historical novel.</p>
		</aside>

		<div id="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

Open in a new tab

This document has two dedicated instruments to toggle the visibility and inclusion in the accessibility tree of the complementary and the navigational blocks of repeated content respectively.

<html>
	<head>
		<script src="/test-assets/bypass-blocks-cf77f2/toggle-display.js"></script>
		<title>The Three Kingdoms, Chapter 1</title>
	</head>
	<body>
		<a href="#" onclick="toggleHidden('chapters-navigation')">Toggle table of content</a>
		<button onclick="toggleHidden('about-book')">Toggle extra content</button>

		<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>

		<aside id="about-book">
			<p>The Romance of the Three Kingdoms is a 14th century historical novel.</p>
		</aside>

		<div id="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 4

Open in a new tab

This document has a button at the start of the document to toggle the visibility and inclusion in the accessibility tree of the navigational block of repeated content. The button is only visible when focused.

<html>
	<head>
		<script src="/test-assets/bypass-blocks-cf77f2/toggle-display.js"></script>
		<link rel="stylesheet" href="/test-assets/bypass-blocks-cf77f2/styles.css" />
		<title>The Three Kingdoms, Chapter 1</title>
	</head>
	<body>
		<button onclick="toggleHidden('chapters-navigation')" class="visible-on-focus">Toggle repeated content</button>

		<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 id="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>

Failed

Failed Example 1

Open in a new tab

This document has no instrument to toggle the navigational block of 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>

		<div id="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>

Failed Example 2

Open in a new tab

This document has an instrument to toggle visibility of the navigational block of repeated content, but none to toggle its inclusion in the accessibility tree.

<html>
	<head>
		<link rel="stylesheet" href="/test-assets/bypass-blocks-cf77f2/styles.css" />
		<script src="/test-assets/bypass-blocks-cf77f2/toggle-display.js"></script>
		<title>The Three Kingdoms, Chapter 1</title>
	</head>
	<body>
		<a href="#" onclick="toggleVisibility('chapters-navigation')">Toggle table of content</a>

		<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 id="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>

Failed Example 3

Open in a new tab

This document has an instrument to toggle the inclusion on the accessibility tree of the block of repeated content, but none to toggle its visibility.

<html>
	<head>
		<script src="/test-assets/bypass-blocks-cf77f2/toggle-display.js"></script>
		<title>The Three Kingdoms, Chapter 1</title>
	</head>
	<body>
		<a href="#" onclick="toggleAriaHidden('chapters-navigation')">Toggle table of content</a>

		<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 id="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>

Inapplicable

Inapplicable Example 1

Open in a new tab

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:

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:

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:

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

An element is focusable if one or both of the following are true:

Exception: Elements that lose focus during a period of up to 1 second after gaining focus, without the user interacting with the page the element is on, are not considered focusable.

Notes:

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 are exposed to assistive technologies. This allows users of assistive technology to access the elements in a way that meets 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.

Programmatically hidden elements are removed from the accessibility tree. However, some browsers will leave focusable elements with an aria-hidden attribute set to true in the accessibility tree. Because they are hidden, these elements are considered not included in the accessibility tree. This may cause confusion for users of assistive technologies because they may still be able to interact with these focusable elements using sequential keyboard navigation, even though the element should not be 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:

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 they are programmatically hidden. This is different from marking the element as decorative and does not convey the same intention. Notably, being programmatically hidden 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:

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:

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:

Perceivable content corresponds to nodes that contain information and are perceived by some categories of users.

Programmatically Hidden

An HTML element is programmatically hidden if either it has a computed CSS property visibility whose value is not visible; or at least one of the following is true for any of its inclusive ancestors in the flat tree:

Note: Contrary to the other conditions, the visibility CSS property may be reverted by descendants.

Note: The HTML standard suggests setting the CSS display property to none for elements with the hidden attribute. While not required by HTML, all modern browsers follow this suggestion. Because of this the hidden attribute is not used in this definition. In browsers that use this suggestion, overriding the CSS display property can reveal elements with the hidden attribute.

Semantic Role

The semantic role of an element is determined by the first of these cases that applies:

  1. 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 it is not programmatically hidden, then its semantic role is its implicit role.
  2. Explicit If the element has an explicit role, then its semantic role is its explicit role.
  3. Implicit The semantic role of the element is its implicit role.

This definition can be used in expressions such as “semantic button” meaning any element with a semantic role of button.

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.

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:

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.

Rule Versions

This is the first version of this ACT rule.

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 Type Consistency Report
Axe DevTools Pro 4.37.1 Semi-automated tool Partial Axe DevTools Pro Report
Axe-core 4.8.3 Automated tool Partial Axe-core Report
QualWeb 3.0.0 Automated tool Partial QualWeb Report
Back to Top