Motion Actuation: Shake and Tilt Need a Button
Also called: Device motion, Shake to undo, Tilt controls, WCAG 2.5.4
Definition
Motion Actuation is WCAG success criterion 2.5.4 (Level A). Functionality that can be operated by device motion or user motion can also be operated by user interface components, and responding to the motion can be disabled to prevent accidental actuation.
Motion actuation means triggering a function by moving: shaking the phone to undo, tilting it to turn a page, or waving at the camera. WCAG 2.5.4 asks that every such function also works with normal controls like buttons, and that people can switch the motion response off. Someone whose phone is mounted on a wheelchair cannot shake it, and someone with a tremor may shake it without meaning to.
What it means
WCAG 2.5.4 Motion Actuation is a Level A criterion. Functionality that can be operated by device motion or user motion can also be operated by user interface components, and responding to the motion can be disabled to prevent accidental actuation – except in two cases:
| Exception | Meaning |
|---|---|
| Supported interface | The motion is used to operate functionality through an accessibility supported interface |
| Essential | The motion is essential for the function and doing so would invalidate the activity |
The criterion is about motion read by sensors such as the accelerometer or a camera. Typing, moving a mouse, touchscreen gestures and the use of assistive technology are not what it targets – touch gestures are covered by pointer gestures (2.5.1).
W3C names who benefits: people who cannot perform certain movements, people whose device is on a fixed mount, for example on a wheelchair, and anyone who cannot move their device at the moment. Turning motion off helps people with tremors or other motor impairments avoid triggering functions by accident.
The rule is related to orientation (1.3.4), which asks that content works in portrait and landscape – a tilt that changes content must not lock people out either way.
Examples
<!-- Shake to undo, with a button that does the same and a switch to turn it off -->
<label for="note">Note</label>
<textarea id="note"></textarea>
<button type="button" id="undo">Undo</button>
<label>
<input type="checkbox" id="motion-off"> Turn off shake to undo
</label>
<script>
const motionOff = document.getElementById('motion-off');
document.getElementById('undo').addEventListener('click', undo);
window.addEventListener('devicemotion', (e) => {
if (motionOff.checked) return; // the user switched motion off
if (isShake(e.accelerationIncludingGravity)) undo();
});
</script>Both W3C examples work this way: shake to undo has an undo button next to the field, and tilting to change pages has previous and next buttons. Make these buttons easy to hit with enough target size and reachable by keyboard navigation.
Offer a visible button for every motion function, add a setting that turns motion responses off, keep the setting where people find it before the first accidental shake, and test with the device lying still on a table.
Make shaking the only way to undo or report a problem, change pages only by tilting, start a game action only with a wave at the camera, or hide the off switch deep in a settings menu.
How to check motion actuation
Questions
What counts as motion actuation?
Operating a function by moving the device, such as shaking or tilting it, or by moving in front of it, such as a gesture a camera reads. Touch gestures, typing and mouse movement are not meant.
Is shake to undo allowed under WCAG?
Yes, if the same undo is available through a normal control such as a button, and people can turn off the response to shaking.
Why must motion be possible to turn off?
People with tremors or other motor impairments may move their device without meaning to. Without a way to turn the response off, they trigger actions by accident.
When is motion essential?
When removing it would invalidate the activity – for example a step counter or an app whose purpose is to measure movement. For undo, navigation or confirming an action, motion is not essential.
Related terms
Pointer Gestures: A Single Tap Must Do It Too
Pointer Gestures is WCAG success criterion 2.5.1 (Level A). All functionality that uses multipoint or path-based gestures can also be operated with a single pointer without a path-based gesture, unless the gesture is essential.
Read definition: Pointer Gestures: A Single Tap Must Do It TooOrientation: Support Portrait and Landscape
Orientation is WCAG success criterion 1.3.4: content must not restrict its view and operation to a single display orientation, such as portrait or landscape, unless a specific orientation is essential.
Read definition: Orientation: Support Portrait and LandscapeKeyboard Navigation: WCAG 2.1.1 Explained
Keyboard navigation means that every function of a website can be reached and operated with a keyboard alone – usually with Tab, Shift+Tab, Enter, Space and the arrow keys. WCAG 2.1.1 requires it at Level A.
Read definition: Keyboard Navigation: WCAG 2.1.1 ExplainedTarget Size: 24 × 24 px for Every Click Target
Target Size (Minimum) is WCAG success criterion 2.5.8. The size of the target for pointer inputs is at least 24 by 24 CSS pixels, unless spacing, an equivalent control, inline text, the user agent or an essential presentation makes an exception.
Read definition: Target Size: 24 × 24 px for Every Click Target