Skip to content

Proposed Test Rule: Text content that changes automatically can be paused, stopped or hidden

Applicability

This rule applies to any HTML element that has a visible text node as a descendant in the flat tree, for which all the following is true:

Expectation

For each test target there is at least one set of instruments, where each instrument is in the same web page as the test target or can be found in a clearly labeled location from that web page, to achieve at least one of the following objectives:

Note: If there is more than one test target, the same instrument may be used to pause (or stop, or hide or alter the frequency) of several or even all test targets.

Assumptions

Accessibility Support

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

Background

The 10 minute time span in the applicability is arbitrary. It is selected so that testing this rule would not become impractical. This 10 minute constraint is not included in WCAG. Content that changes less frequently may fail success criteria 2.2.2 without failing this rule.

The instruments used to pass this rule (if any), must meet all level A Success Criteria in order to fully satisfy Success Criterion 2.2.2: Pause, Stop, Hide. These extra requirements are left out of this rule, and should be tested separately.

Bibliography

Accessibility Requirements Mapping

Input Aspects

The following aspects are required in using this rule.

Test Cases

Passed

Passed Example 1

This span element contains text content that is automatically changed multiple times without user intervention and there is a button available to stop the automatic changes. The rule is not applicable to the second p element because it has a child changed (the span element).

<body onload="startUpdates()">
	<p>
		The W3C Web Accessibility Initiative (WAI) develops standards and support materials to help you understand and
		implement accessibility.
	</p>

	<p>Random number: <span id="target">1</span></p>
	<input type="button" onclick="stopUpdates()" value="Stop changes" />

	<script type="text/javascript" src="/test-assets/efbfc7/script.js"></script>
</body>

Passed Example 2

This span element contains text content that is automatically changed multiple times without user intervention and there is a button available to pause and resume the automatic changes. The rule is not applicable to the second p element because it has a child changed (the span element).

<body onload="startUpdates()">
	<p>
		The W3C Web Accessibility Initiative (WAI) develops standards and support materials to help you understand and
		implement accessibility.
	</p>

	<p>Random number: <span id="target">1</span></p>
	<input type="button" id="control" onclick="toggleUpdates()" value="Pause changes" />

	<script type="text/javascript" src="/test-assets/efbfc7/script.js"></script>
</body>

Passed Example 3

This span element contains text content that is automatically changed multiple times without user intervention and there is a button available to hide the automatically updating content. The rule is not applicable to the second p element because it has a child changed (the span element).

<body onload="startUpdates()">
	<p>
		The W3C Web Accessibility Initiative (WAI) develops standards and support materials to help you understand and
		implement accessibility.
	</p>

	<p>Random number: <span id="target">1</span></p>
	<input type="button" onclick="hide()" value="Hide changing content" />

	<script type="text/javascript" src="/test-assets/efbfc7/script.js"></script>
</body>

Passed Example 4

This span element contains text content that is automatically changed multiple times without user intervention and there is an instrument available to modify the frequency of the changes. The rule is not applicable to the second p element because it has a child changed (the span element).

<body onload="startUpdates()">
	<p>
		The W3C Web Accessibility Initiative (WAI) develops standards and support materials to help you understand and
		implement accessibility.
	</p>

	<p>Random number: <span id="target">1</span></p>
	<label for="interval">Content change frequency (seconds):</label>
	<input type="text" id="interval" />
	<input type="button" onclick="changeFrequency(document.getElementById('interval').value)" value="Change frequency" />

	<script type="text/javascript" src="/test-assets/efbfc7/script.js"></script>
</body>

Passed Example 5

This span element contains text content that is automatically changed multiple times without user intervention and the location of an instrument to control the changes is clearly available.

<body onload="startUpdates()">
	<p>
		The W3C Web Accessibility Initiative (WAI) develops standards and support materials to help you understand and
		implement accessibility.
	</p>

	<p>Random number: <span id="target">1</span></p>
	<p>To control the random number updates activate the "Control changes" button.</p>
	<input type="button" onclick="openModal()" value="Control changes" />

	<div
		style="
      display: none;
      position: fixed;
      top: 2em;
      left: 10em;
      background-color: #505050;
      color: white;
      padding: 1em;
      padding-top: 0em;
    "
		id="overlay"
	>
		<p>Control changes</p>
		<input type="button" id="control" onclick="toggleUpdates()" value="Pause changes" />
		<input type="button" onclick="hide()" value="Hide changes" />
		<button onclick="closeModal();">Dismiss</button>
	</div>

	<script type="text/javascript">
		function openModal() {
			document.getElementById('overlay').style.display = 'block'
		}
		function closeModal() {
			document.getElementById('overlay').style.display = 'none'
		}
	</script>
	<script type="text/javascript" src="/test-assets/efbfc7/script.js"></script>
</body>

Failed

Failed Example 1

This span element contains text content that is automatically changed multiple times without user intervention and there is no instrument available to stop, pause, hide or alter the frequency of the automatic changes.

<body onload="startUpdates()">
	<p>
		The W3C Web Accessibility Initiative (WAI) develops standards and support materials to help you understand and
		implement accessibility.
	</p>

	<p>Random number: <span id="target">1</span></p>

	<script type="text/javascript" src="/test-assets/efbfc7/script.js"></script>
</body>

Inapplicable

Inapplicable Example 1

This document does not have any visible text node.

<img src="/test-assets/shared/w3c-logo.png" alt="W3C logo" />
<p style="display: none">
	The W3C Web Accessibility Initiative (WAI) develops standards and support materials to help you understand and
	implement accessibility.
</p>

Inapplicable Example 2

This document does not have text content that is automatically changed.

<p>
	The W3C Web Accessibility Initiative (WAI) develops standards and support materials to help you understand and
	implement accessibility.
</p>

Inapplicable Example 3

This span element changes color but not its innerText property.

<body onload="startColorUpdates()">
	<p>
		The W3C Web Accessibility Initiative (WAI) develops standards and support materials to help you understand and
		implement accessibility.
	</p>

	<p>Number: <span id="target">1</span></p>
	<input type="button" onclick="stop()" value="Stop color changes" />

	<script>
		const myColors = ['red', 'green', 'blue', 'black']
		let updates

		function startColorUpdates() {
			updates = setInterval(change, 1000)
		}

		function change() {
			let randomColor = myColors[Math.floor(Math.random() * myColors.length)]
			var target = document.getElementById('target')
			target.style.color = randomColor
		}

		function stop() {
			clearInterval(updates)
		}
	</script>
</body>

Inapplicable Example 4

This span element contains text content that is automatically changed but only as a result of the user activating a button on the page.

<body>
	<p>
		The W3C Web Accessibility Initiative (WAI) develops standards and support materials to help you understand and
		implement accessibility.
	</p>

	<p>Random number: <span id="target">1</span></p>
	<input type="button" id="control" onclick="toggleUpdates()" value="Start changes" />

	<script type="text/javascript" src="/test-assets/efbfc7/script.js"></script>
</body>

Inapplicable Example 5

This span element with text content that automatically changes multiple times is alone in the document.

<body onload="startUpdates()">
	<span id="target">1</span>

	<script type="text/javascript" src="/test-assets/efbfc7/script.js"></script>
</body>

Glossary

Clearly labeled location

Secondary information and alternative controls of functionality are often not displayed together with primary information or functionality. For example, an option to change a web page to dark mode may be placed on an options page instead of being available on every page and page state of a website. Another example is a maps application, where, instead of using GPS, an option is available in a dropdown menu to set the current location of the device. Such content should be placed in a clearly labeled location.

The location of a target is said to be clearly labeled when the target can be found by activating “identifiable” instruments which either lead the user to find the target, or to another page or page state from which this action can be repeated until the target is found.

Whether or not the content is “clearly labeled” depends on the starting point of the search. If page A has a link which clearly “identifies” some piece of content, then the location of the content is clearly labeled. Page B, which can be in the same website, may not have such a link or may have a link with a link text that does not “identify” target content or which can be interpreted to “identify” more than one target, and so the location of the content starting from page B is not clearly labeled.

For the purpose of this definition, an instrument is identifiable if any text or other content with a text alternative, allows any user to identify an element with a semantic role that inherits from widget.

A web page changes state when the document’s body changes without a change in the document’s URL.

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.

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.

Namespaced Element

An element with a specific namespaceURI value from HTML namespaces. For example an “SVG element” is any element with the “SVG namespace”, which is http://www.w3.org/2000/svg.

Namespaced elements are not limited to elements described in a specification. They also include custom elements. Elements such as a and title have a different namespace depending on where they are used. For example a title in an HTML page usually has the HTML namespace. When used in an svg element, a title element has the SVG namespace instead.

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.

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: Contrarily to the other conditions, the visibility CSS property may be reverted by descendants.

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.

User interaction

A user interaction is any action that causes the user agent to fire one of the following DOM events:

This list comprises the User Interface event that are generated by the user agent as a result of user interaction.

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.

Visible Text Content

The visible text content of an element is a set of all visible text nodes that are descendants in the flat tree of this element

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.

Implementations

There are currently no known implementations for this rule. If you would like to contribute an implementation, please read the ACT Implementations page for details.

Changelog

This is the first version of this ACT rule.

Back to Top