keyboard-focusable
Operable UI element must be reachable by keyboard.
Description
Some users rely on keyboard navigation, even when using mobile devices. This makes it imperative that all interactive user interface (UI) elements are fully reachable and operable via keyboard or other non-pointing input methods. In native mobile development frameworks such as Android XML, most standard interactive UI controls (like Button, EditText) are designed to be keyboard-accessible by default. However, it's crucial for developers to ensure they do not inadvertently override or disable these inherent accessibility properties.
Quick Fixes
In most cases when it comes to mobile frameworks interactive views and components can be reached with a keyboard by default, however developers should pay attention not to override the default properties that make elements reachable by keyboards.
Fail Patterns
Android XML Views
1<Button2 android:id="@+id/nonFocusableButton"3 android:layout_width="wrap_content"4 android:layout_height="wrap_content"5 android:focusable="false" />
1<ImageView2 android:id="@+id/nonFocusableClickableImageView"3 android:layout_width="wrap_content"4 android:layout_height="wrap_content"5 android:clickable="true"6 android:focusable="false"/>
Pass Patterns
Android XML Views (XML)
1view.focusable = View.FOCUSABLE2// OR3view.isFocusable = true
1setOnFocusChangeListener { v, hasFocus ->2 background = if (hasFocus) {3 ContextCompat.getDrawable(context, ...)4 } else {5 ContextCompat.getDrawable(context, ...)6 }7}
How Users Are Affected
Keyboard users won\’t be able to reach and operate elements that are not focusable by keyboard.
WCAG Success criteria
This issue might cause elements to fail one or more of the following Success criteria:
2.1.1 Keyboard (A)