Skip to main content
Logo Appt Light

Success Criterion 2.4.3 - Level A

Focus Order

Ensure assistive technologies use a logical focus order when navigating. The order of navigating a screen is usually from left to right, from top to bottom. Make sure assistive technologies use an equivalent focus order.

Impact

People who use assistive technologies such as the screen reader, keyboard, and switch controls benefit from a focus order that makes sense.

Check

Do assistive technologies use a logical order to navigate through the screen?

This can be tested with a screen reader or keyboard access.

Solution

Adjust order for keyboard

On Android, you can use several focus properties to modify the keyboard focus order.

<View
    android:id="@+id/notFocusable"
    android:focusable="false"/>

<EditText
    android:id="@+id/field1"
    android:focusable="true"
    android:nextFocusForward="@+id/field2"
    android:nextFocusDown="@+id/field3"
    android:nextFocusRight="@+id/field2"/>

<EditText
    android:id="@+id/field2"
    android:focusable="true"
    android:nextFocusForward="@+id/field3"
    android:nextFocusDown="@+id/field4"/>

<EditText
    android:id="@+id/field3"
    android:focusable="true"
    android:nextFocusForward="@+id/field4"/>

<EditText
    android:id="@+id/field4"
    android:focusable="true"/>

Adjust order for assistive technologies

On Android, you can set the accessibility order in XML, or modify the accessibility order in code. You can use the android:accessibilityTraversalAfter and android:accessibilityTraversalBefore properties in XML. Or you can use the setAccessibilityTraversalBefore and setAccessibilityTraversalAfter methods in code.

header.setAccessibilityTraversalBefore(R.id.description)
list.setAccessibilityTraversalAfter(R.id.description)

Move accessibility focus

On Android, you can send an AccessibilityEvent of the type TYPE_VIEW_FOCUSED to move the focus of assistive technologies to a specific view. The view must be focusable for this event to take effect.

fun focus(view: View) {
    view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED)
}

Resources

Feedback?

Let us know!