Success Criterion 3.2.1 - Level A
On Focus
Ensure it is predictable what happens when users move to an element. When an element receives focus, it should not be activated unexpectedly. Predictable focus behavior makes it easier for people with disabilities to use your app.
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
}
}