Success Criterion 2.5.2 - Level A
Pointer Cancellation
Ensure it is possible to cancel touches. Buttons may only be activated with a click and not with a touch. This gives the user the option to cancel the touch.
Impact
Being able to cancel touches is helpful for everyone to prevent accidental touches. This is especially helpful for people with visual, cognitive or motor disabilities.
Check
“Is it possible to cancel touches, to avoid click events?“
This can be tested without assistive technologies.
Solution
Support input cancellation
On Android, you should avoid using the ACTION_DOWN
event of OnTouchListener
, because users will not be able to cancel their interaction. Actions should only be activated through an ACTION_UP
event. Use an OnClickListener
instead, because it has built-in support for cancellation.
webView.setOnTouchListener { _, event ->
if (event == MotionEvent.ACTION_DOWN) {
// Use OnClickListener instead
}
}