Pointer Cancellation: Act on Release, Not on Press
Also called: Up-event activation, Accidental activation, Down-event, WCAG 2.5.2
Definition
Pointer Cancellation is WCAG success criterion 2.5.2 (Level A). For functions operated with a single pointer, the down-event does not trigger the function, or completion on the up-event can be aborted or undone, or the up-event reverses it, unless the down-event is essential.
Pointer cancellation is the chance to change your mind after pressing the wrong button: you press, notice the mistake, slide your finger or mouse away and release – and nothing happens. WCAG 2.5.2 protects that chance by asking that actions run when the pointer is released, not the moment it touches down. It prevents accidental purchases, deletions and page changes.
What it means
WCAG 2.5.2 Pointer Cancellation is a Level A criterion. For functionality that can be operated with a single pointer, at least one of four conditions is true:
| Condition | What it means |
|---|---|
| No down-event | The down-event (e.g. mousedown, touchstart) does not execute any part of the function |
| Abort or undo | The function completes on the up-event (mouseup, touchend, click), and there is a way to abort before completion or undo afterwards |
| Up reversal | The up-event reverses any outcome of the preceding down-event |
| Essential | Completing the function on the down-event is essential |
Functions that emulate a keyboard or numeric keypad key press count as essential, so an on-screen piano or keyboard may react on press. The rule covers content that interprets pointer actions, not the controls of the browser or assistive technology.
W3C names the benefit: all users can recover from hitting the wrong target, and people with visual, motor or cognitive disabilities trigger fewer actions by accident – and are less disoriented by unexpected changes of context.
Examples
<!-- Bad: the order is placed the moment the button is pressed -->
<div role="button" tabindex="0" onmousedown="placeOrder()">Buy now</div>
<!-- Good: a native button reacts on release, sliding off cancels -->
<button type="button" onclick="placeOrder()">Buy now</button>
<!-- Good: press and hold to preview, releasing hides it again (up reversal) -->
<button type="button" id="peek">Show password</button>
<script>
const peek = document.getElementById('peek');
peek.addEventListener('pointerdown', () => showPassword(true));
peek.addEventListener('pointerup', () => showPassword(false));
peek.addEventListener('pointerleave', () => showPassword(false));
</script>The press-and-hold preview follows a W3C example: what appears on press disappears again on release. For drag and drop, W3C shows the abort route: an item dropped outside a valid target goes back to where it was. More on that in dragging movements.
Use native buttons and links with the click event, let drag and drop snap back when the item is released outside a target, add an "Undo" for actions that cannot wait, and give buttons enough target size to hit them in the first place.
Trigger purchases, deletions, navigation or form submission on mousedown, touchstart or pointerdown, or open a menu on press that also selects the item under the pointer.
How to check pointer cancellation
Questions
What is the difference between a down-event and an up-event?
The down-event happens when the pointer is pressed, such as mousedown or touchstart. The up-event happens when it is released, such as mouseup or touchend. WCAG 2.5.2 wants functions to complete on the up-event.
Does the click event meet WCAG 2.5.2?
Yes, in practice. The click event of native buttons and links fires on release and only when the pointer is still on the element, so sliding away cancels it.
Are press-and-hold actions allowed?
Yes, if releasing reverses what pressing did – for example a preview that shows while the pointer is down and hides on release. W3C calls this up reversal.
When may a function trigger on press?
Only when it is essential, such as an on-screen keyboard or piano that imitates a key press. W3C counts emulating a keyboard or numeric keypad key press as 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 TooTarget 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 TargetDragging Movements: Offer a Click Alternative
Dragging Movements is WCAG success criterion 2.5.7. All functionality that uses a dragging movement for operation can be achieved by a single pointer without dragging, unless dragging is essential or the browser provides it.
Read definition: Dragging Movements: Offer a Click AlternativeKeyboard 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 Explained