Skip to main content
Logo Appt Light

Success Criterion 2.1.1 - Level A

Keyboard

Ensure that all functionality in an app can be used via the keyboard interface. This includes external keyboard, screen reader, switch control and voice control. Visually impaired people use a screen reader. People with a motor disability use switch control and voice control.

Impact

  • People who are blind often use a screen reader to operate apps.

  • People with limited hand function often have difficulty using the touchscreen. Using a keyboard is a solution for them.

  • People with motor disabilities often use switch control or voice control to operate an app.

Check

Can you fully operate the app when using assistive technologies?

We recommend to test with at least the screen reader, voice control, keyboard access or switch access.

Solution

All interactive elements must be operable with assistive technologies. It can be needed to move the focus of assistive technologies.

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!