Success Criterion 2.5.1 - Level A
Pointer Gestures
Ensure an alternative is provided for all gesture-triggered actions. People with a motor disability cannot perform all gestures. For example, not everyone is able to move two fingers apart to zoom. Add an alternative, such as a button, to allow users to zoom in without gestures.
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)
}