We'd like to set Google Analytics cookies to learn how people use the Knowledge Base, so we can improve it. We set them only if you accept.

Skip to main content
Digital Accessibility Knowledge Base

on-focus

Mobile validation

When an element receives focus, it must not trigger a change of context, such as navigating to a new screen, opening a modal, or changing the element's state.

The focus state shows that an element is ready for user input. When focus alone causes a change of context, such as navigating to a new screen, opening a modal, submitting a form, or checking a checkbox, the interface becomes unpredictable. Keyboard users, screen reader users, and people with cognitive disabilities can lose their place, and people with motor disabilities may struggle to undo an action they did not intend. Make sure significant changes happen only when the user actively triggers them, for example by activating a button with Enter or Space, and never as the result of an element simply receiving focus.

Pass Patterns

Android

The guests selector opens only when the field is activated, not when it receives focus.

Kotlin
guestsField.setOnClickListener {
    showGuestsSheet()
}

Cross Platform

React Native (Android)

The dialog opens only when the field is activated, not when it receives focus.

TSX
<Pressable accessibilityRole="button" onPress={showDialog}>
  <Text style={styles.bodyLarge}>Show dialog</Text>
</Pressable>

Fail Patterns

Two screenshots of a travel app. In the first, before focus, the search form shows Destination, Dates, and Guests fields. In the second, the Guests field receives focus, and a sheet for choosing the number of rooms, adults, and children opens over the screen.

Checkbox checked on focus

Two screenshots of a screen titled “Selectable List”, asking to select your favorite fruits. In the first, before focus, the “Apple” checkbox is unchecked. In the second, the checkbox receives focus and becomes checked.

Android

The guests selector opens as soon as the field receives focus.

Kotlin
guestsField.setOnFocusChangeListener { _, hasFocus ->
    if (hasFocus) showGuestsSheet()
}

The checkbox becomes checked as soon as it receives focus.

Kotlin
appleCheckBox.setOnFocusChangeListener { _, hasFocus ->
    if (hasFocus) appleCheckBox.isChecked = true
}

Cross Platform

React Native (Android)

The dialog opens as soon as the field receives focus.

TSX
<Pressable accessibilityRole="button" focusable onFocus={showDialog}>
  <Text style={styles.bodyLarge}>Show dialog</Text>
</Pressable>

Try It Yourself

Using a keyboard

  1. Connect an external keyboard to the device. On iOS, also turn on Settings > Accessibility > Keyboards > Full Keyboard Access.
  2. Press Tab, or use the arrow keys, to move keyboard focus through the screen.
  3. Watch what happens each time an element receives focus.

Expected results: The focused element shows that it has focus, and nothing else on the screen changes.

Actual results: Moving focus to an element opens a modal, navigates to another screen, changes the layout, or changes the element's state.

FAQ

How does this issue relate to 3.2.1 On Focus?

SC 3.2.1 requires that when any user interface component receives focus, it does not initiate a change of context. Opening a modal, navigating to a new screen, or changing an element's state just because it received focus is such a change, so the criterion is not met.

Why is this issue marked as Serious?

Unexpected changes on focus make the interface unpredictable. Users can lose their place, trigger actions they did not intend, and struggle to undo them, which can interrupt critical tasks, so it is rated serious.

Standards and Regulations

StandardSuccess CriterionReference
WCAG 2.23.2.1 On Focus (A)When any user interface component receives focus, it does not initiate a change of context.
EN 301 54911.3.2.1 On FocusSame as the WCAG text.
Section 5081194.21(l)When electronic forms are used, the form shall allow people using assistive technology to access the information, field elements, and functionality required for completion and submission of the form, including all directions and cues.

Personas impacted by this issue

Learn More