Success Criterion 3.2.1 - Level A
On Focus
Ensure it is predictable what happens when you move the focus. When users move their finger over a button, it should not be activated unexpectedly. If the last field of a form is filled in, it should not be sent unexpectedly. These types of actions should only be performed automatically if users are notified in advance. By making focus behavior predictable, you help people with a visual, cognitive or motor impairment.
Impact
A button should not be activated automatically when you move your finger over it. This reduces the chance that unconscious actions will take place for people with visual, cognitive and motor disabilities.
Check
“Does the focus never move unexpectedly?”
This can be tested with a screen reader of keyboard access.
Solution
Check focus behavior
On Android, you can use an OnFocusChangeListener
to listen to focus changes. The onFocusChange
method is called when the element receives focus.
Be careful when using the onFocusChange
method: do not trigger any context change because they might confuse users.
webView.setOnFocusChangeListener { view, focused ->
if (focused) {
// Do not change context
}
}