Traversal order

A person who uses the TalkBack screen reader can navigate an app in two ways:

  • Explore by touch: Drag a single finger over the screen to explore the physical arrangement of elements.
  • Linear navigation: Swipe right and left to move forward and backward, one item at a time. 

Android apps should support both touch exploration and linear navigation. The traversal order during linear navigation should generally match the visual order, or the traversal order should be optimized in another way to keep the ordering logical for users of screen readers.  

By default, TalkBack uses the app’s view hierarchy to determine the traversal order of items during linear navigation.


In cases where an app’s view hierarchy does not reflect the logical structure of the app, developers can influence accessibility traversal by setting android:accessibilityTraversalBefore or android:accessibilityTraversalAfter. These properties indicate that a screen reader should visit the content of one view before (or after) the content of another. Views without before/after relationships are traversed in an order determined by the screen reader.

Accessibility traversal order is distinct from the "input focus" order used for keyboard navigation. The keyboard navigation order is specified by android:nextFocusDown, android:nextFocusLeft, android:nextFocusRight, and android:nextFocusUp.

When using accessibilityTraversalBefore and accessibilityTraversalAfter, consider the following tips to avoid over-constraining the traversal order:

  • Only use these attributes in places where logical ordering differs from view hierarchy ordering.
  • Each element that a user can focus with touch exploration should also be focusable during linear navigation.
  • Traversal order should be consistent with linear navigation, regardless of direction. For example, a gesture to move focus to the "next" element immediately followed by a gesture to move focus to the "previous" element should always result in focus returning to the original element.
  • Cycles should not be introduced when defining accessibilityTraversalBefore and accessibilityTraversalAfter, or users may encounter situations where certain elements are unreachable when using linear navigation.


When designing an app, consider how you intend a person who uses a screen reader to linearly traverse information presented in the interface. Ideally, the traversal order matches that of the visual presentation of information. However, when this match isn't possible, you can specify a traversal order that conveys the logical structure or intent of the interface.

Learn more about creating easy-to-follow navigation.


To manually evaluate the accessibility traversal order of an app:

  1. Turn on TalkBack.
  2. Open the app.
  3. Use linear navigation gestures to move accessibility focus to each element on the screen.
  4. Verify that TalkBack moves its focus through the elements on the screen in a logical order and speaks a meaningful representation of each element that it visits.
  5. Verify that TalkBack moves focus backwards and forwards through elements on the screen in a consistent manner, regardless of navigation direction.

Android's automated testing tools can detect some traversal order issues. Consider using Accessibility Scanner for Android for manual testing of your app on-device. For automated tests, turn on accessibility checking in Espresso and Robolectric.

Clear search
Close search
Google apps
Main menu
Search Help Center