Proposed Device motion based changes to the content can also be created from the user interface
Description
This rule checks that changes to the content of a web page that result from device motion events can also be caused by user interface components.
Applicability
This rule applies to any HTML document with an associated Window object that has an event listener list with one or more event listeners for device orientation events or device motion events.
Expectation
For each registered device orientation event or device motion event in the test target at least one of the following is true:
- no changes: The registered event does not cause changes to the content of the web page; or
- same result: There is at least one set of instruments, where each instrument is in the same web page of the registered event or can be found in a clearly labeled location from that web page, causing the same changes in content as the event.
Background
The instruments used to pass this rule (if any), must meet all level A Success Criteria in order to fully satisfy Success Criterion 2.5.4: Motion Actuation. These extra requirements are left out of this rule, and should be tested separately.
Assumptions
- The motion to operate the device is not used through an accessibility supported interface, which is listed as a valid exception to Success Criterion 2.5.4: Motion Actuation.
- The motion is not essential for the functionality it triggers, which is listed as a valid exception to Success Criterion 2.5.4: Motion Actuation.
- This rule assumes that there are no changes in the content of the web page caused by another event. If this is not the case, changes may be attributed to the wrong event and the rule may fail while Success Criterion 2.5.4: Motion Actuation is still satisfied.
- This rule assumes that the changes happen within a 1 minute time span after the event firing and therefore the comparison between the page before and after the event firing can be made at any time after that time span elapses. If there are changes after this time span, they may not be detected as changes in content and the rule may pass but Success Criterion 2.5.4: Motion Actuation is not satisfied. The arbitrary 1 minute time span, selected so that testing this rule would not be impractical, is not included in WCAG.
Accessibility Support
There are no accessibility support issues known.
Bibliography
- Understanding Success Criterion 2.5.4: Motion Actuation
- G213: Provide conventional controls and an application setting for motion activated input
- DeviceOrientation Event Specification
Accessibility Requirements Mapping
2.5.4 Motion Actuation (Level A)
- Learn more about 2.5.4 Motion Actuation
- Required for conformance to WCAG 2.1 on level A and higher.
- Outcome mapping:
- Any
failed
outcomes: success criterion is not satisfied - All
passed
outcomes: success criterion needs further testing - An
inapplicable
outcome: success criterion needs further testing
- Any
Input Aspects
The following aspects are required in using this rule.
Test Cases
This Javascript file is used in several examples:
File /test-assets/7677a9/slider.js
:
function changeSlider(amount) {
document.getElementById('motionSlider').value += amount
document.getElementById('output').innerHTML = document.getElementById('motionSlider').value
}
function increaseSlider() {
changeSlider(+1)
}
function decreaseSlider() {
changeSlider(-1)
}
function applyChange(gamma, threshold) {
if (gamma > threshold) {
increaseSlider()
} else if (gamma < -threshold) {
decreaseSlider()
}
}
function handleOrientation(event) {
applyChange(event.gamma, 20)
}
function handleOrientationCanBeDisabled(event) {
const disableMotion = document.getElementById('disableMotion')
if (!disableMotion.checked) {
applyChange(event.gamma, 20)
}
}
function handleMotion(event) {
applyChange(event.rotationRate.gamma, 5)
}
function handleMotionCanBeDisabled(event) {
const disableMotion = document.getElementById('disableMotion')
if (!disableMotion.checked) {
applyChange(event.rotationRate.gamma, 5)
}
}
Passed
Passed Example 1
This HTML document has device orientation events that cause no changes to the content of the web page.
<html>
<head>
<title>Passed Example 1</title>
<script>
function activateEvent() {
let counter = 0
window.addEventListener('deviceorientation', () => {
counter++
})
}
</script>
</head>
<body onload="activateEvent();">
<p>ACT-R</p>
<p>Note: This example may not work across all browsers.</p>
</body>
</html>
Passed Example 2
This HTML document that can be operated through the device’s orientation to increase and decrease the value of a slider has the same result available through button
elements.
<html>
<head>
<title>Passed Example 2</title>
<script src="/test-assets/7677a9/slider.js"></script>
<script>
function activateSlider() {
document.getElementById('decreaseSlider').addEventListener('click', decreaseSlider)
document.getElementById('increaseSlider').addEventListener('click', increaseSlider)
window.addEventListener('deviceorientation', handleOrientation)
}
</script>
</head>
<body onload="activateSlider();">
<pre class="output"></pre>
<h1>Slider Motion Sensor Example</h1>
<p>
Open this slider on a device with a motion sensor, such as a smart phone or tablet. Tilt the device to the right
and left to adjust the slider value. The decrease and increase buttons also adjust the value.
</p>
<p>Note: This example may not work across all browsers.</p>
<div>
<button id="decreaseSlider" type="button">Decrease Value</button>
<input type="range" min="1" max="100" value="50" id="motionSlider" disabled />
<button id="increaseSlider" type="button">Increase Value</button>
<p aria-live="polite">Slider Value: <span id="output">50</span></p>
</div>
</body>
</html>
Passed Example 3
This HTML document that can be operated by rotating the device to increase and decrease the value of a slider has the same result available through button
elements.
<html>
<head>
<title>Passed Example 3</title>
<script src="/test-assets/7677a9/slider.js"></script>
<script>
function activateSlider() {
document.getElementById('decreaseSlider').addEventListener('click', decreaseSlider)
document.getElementById('increaseSlider').addEventListener('click', increaseSlider)
window.addEventListener('devicemotion', handleMotion)
}
</script>
</head>
<body onload="activateSlider();">
<pre class="output"></pre>
<h1>Slider Motion Sensor Example</h1>
<p>
Open this slider on a device with a motion sensor, such as a smart phone or tablet. Rotate the device to adjust
the slider value. The decrease and increase buttons also adjust the value.
</p>
<p>Note: This example may not work across all browsers.</p>
<div>
<button id="decreaseSlider" type="button">Decrease Value</button>
<input type="range" min="1" max="100" value="50" id="motionSlider" disabled />
<button id="increaseSlider" type="button">Increase Value</button>
<p aria-live="polite">Slider Value: <span id="output">50</span></p>
</div>
</body>
</html>
Passed Example 4
This HTML document can be operated by rotating the device to increase and decrease the value of a slider and the location of an instrument to support the same results is clearly available.
<html>
<head>
<title>Passed Example 4</title>
<script src="/test-assets/7677a9/slider.js"></script>
<script>
function activateSlider() {
document.getElementById('decreaseSlider').addEventListener('click', decreaseSlider)
document.getElementById('increaseSlider').addEventListener('click', increaseSlider)
window.addEventListener('devicemotion', handleMotion)
}
function openModal() {
document.getElementById('overlay').style.display = 'block'
}
function closeModal() {
document.getElementById('overlay').style.display = 'none'
}
</script>
</head>
<body onload="activateSlider();">
<pre class="output"></pre>
<h1>Slider Motion Sensor Example</h1>
<p>
Open this slider on a device with a motion sensor, such as a smart phone or tablet. Rotate the device to adjust
the slider value. Activate the control panel to access decrease and increase buttons that also adjust the value.
</p>
<input type="button" onclick="openModal()" value="Control panel" />
<p>Note: This example may not work across all browsers.</p>
<input type="range" min="1" max="100" value="50" id="motionSlider" disabled />
<p aria-live="polite">Slider Value: <span id="output">50</span></p>
<div
style="
display: none;
position: fixed;
top: 17em;
left: 1em;
background-color: #505050;
color: white;
padding: 0.5em;
"
id="overlay"
>
<button id="decreaseSlider" type="button">Decrease Value</button>
<button id="increaseSlider" type="button">Increase Value</button>
<button onclick="closeModal();">Dismiss</button>
</div>
</body>
</html>
Failed
Failed Example 1
This HTML document that can be operated through the device’s orientation to increase and decrease the value of a slider has not other way to achieve the same result.
<html>
<head>
<title>Failed Example 1</title>
<script src="/test-assets/7677a9/slider.js"></script>
<script>
function activateSlider() {
window.addEventListener('deviceorientation', handleOrientation)
}
</script>
</head>
<body onload="activateSlider();">
<pre class="output"></pre>
<h1>Slider Motion Sensor Example</h1>
<p>
Open this slider on a device with a motion sensor, such as a smart phone or tablet. Tilt the device to the right
and left to adjust the slider value.
</p>
<p>Note: This example may not work across all browsers.</p>
<div>
<input type="range" min="1" max="100" value="50" id="motionSlider" disabled />
<button id="increaseSlider" type="button">Increase Value</button>
<p aria-live="polite">Slider Value: <span id="output">50</span></p>
</div>
</body>
</html>
Inapplicable
Inapplicable Example 1
This HTML document is not operable by device motion.
<p>ACT-Rules</p>
Glossary
Changes in content
A event originated change in the content of a web page occurs when, by comparing the web page before and 1 minute after the event firing, at least one of the following occurs:
- visible changes: the rendered pixels change in any part of the document that is currently within the viewport or that can be brought into the viewport via scrolling; or
- accessibility tree changes: any state, property or event of a node representing an accessible object of the accessibility tree changes, or any node is inserted in, or removed from the accessibility tree; or
-
audible changes: the audio rendered by the web page changes.
- If the web page is rendering time-based media, rendered pixels and audio will be changing as part of the playback. The comparison in this instance should compare the pixels and audio that are rendered if the event is not fired, with the ones that are rendered if the event is fired.
Assumptions:
- This definition assumes that there are no changes in the content of the web page caused by another event. If this is not the case, changes may be attributed to the wrong event.
- This definition assumes that the changes happen within a 1 minute time span after the event firing and therefore the comparison between the page before and after the event firing can be made at any time after that time span elapses. If there are changes after this time span, this definition may not detect them. The arbitrary 1 minute time span, selected so that testing this rule would not be impractical, is not included in WCAG.
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
An element is focusable if one or both of the following are true:
- the element is part of sequential focus navigation; or
- the element has a tabindex value that is not null.
Exception: Elements that lose focus and do not regain 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:
- The 1 second time span is an arbitrary limit which is not included in WCAG. Given that scripts can manage the focus state of elements, testing the focusability of an element consistently would be impractical without a time limit.
- The tabindex value of an element is the value of the tabindex attribute parsed using the rules for parsing integers. For the tabindex value to be different from null, it needs to be parsed without errors.
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:
- 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 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.
Outcome
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 five 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
- cantTell: Whether the rule is applicable, or not all expectations were met could not be fully determined by the tester.
- Untested: The tester has not attempted to evaluate the test subject.
Note: A rule has one passed
or failed
outcome for every test target. When a tester evaluates a test target it can also be reported as cantTell
if the rule cannot be tested in its entirety. For example, when applicability was automated, but the expectations have to be evaluated manually.
When there are no test targets the rule has one inapplicable
outcome. If the tester is unable to determine whether there are test targets there will be one cantTell
outcome. And when no evaluation has occurred the test target has one untested outcome. This means that each test subject always has one or more outcomes.
Outcomes used in ACT Rules can be expressed using the outcome property of the [EARL10-Schema][].
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:
- has a computed CSS property
display
ofnone
; or - has an
aria-hidden
attribute set totrue
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:
- 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.
- 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.
This definition can be used in expressions such as “semantic button
” meaning any element with a semantic role of button
.
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.2
- 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.
Rule Versions
This is the first version of this ACT rule.
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.