Success Criterion 2.5.1 - Level A
Pointer Gestures
Ensure there is an alternative for gesture-activated actions. Not everyone is able to move two fingers apart or able to swipe. Provide an alternative, such as a button, that allows the user to perform the action.
Impact
It can be difficult for people with a motor disability to make swipe gestures. Make sure that swiping is not necessary to reach all information.
It can be difficult for people with a motor disability to use multiple fingers. By offering an alternative, they can use the same functionality.
Check
“Is an alternative available for gesture-triggered actions?“
This can be tested without assistive technologies.
Solution
Provide alternatives for gestures
On Android, the GestureDetector
and OnGestureListener
objects are a common way to detect gestures.
A gesture should not be the only way to trigger actions. Make sure to provide a second way, such as a button, to trigger the same action.
val scaleGestureDetector = ScaleGestureDetector(
this,
object : ScaleGestureDetector.SimpleOnScaleGestureListener() {
override fun onScale(detector: ScaleGestureDetector): Boolean {
// Provide alternative
return super.onScale(detector)
}
}
)
view.setOnTouchListener { _, event ->
scaleGestureDetector.onTouchEvent(event)
}