Connect & Get help from fellow developers on our Discord community.
Ask the Community
Traversal Order
The traversal order rule checks for the following:
- All app elements that can be focused on through touch exploration are accessible.
- App elements follow a logical focus order that reflects their visual layout.
- The app does not create a focus loop during screen reader navigation.
- Rule Category :
Keyboard and Focus Navigation
- WCAG 2.1 & 2.2 SC :
2.4.3 (A)
- Rule Severity :
Critical
- Supported Platforms :
Android
,iOS
Success Criteria
The specific criteria for success are:
- On Android and iOS, avoid creating traversal cycles that can cause screen readers to get stuck in a loop.
- On iOS, each element that a can be focused on using touch exploration should also be focusable during linear navigation when using assistive technology.
How to fix
To prevent traversal order violations:
- Do not create traversal cycles, or navigation loops when using
accessibilityTraversalBefore
oraccessibilityTraversalAfter
attributes. - Specify a logical traversal order by pointing to the next (or previous) element using these attributes.
- Ensure the traversal order matches the visual layout of the elements.
- In UIKit, review the
accessibilityElements
array if you need to override the default VoiceOver reading order, which is based on the screen layout (top-left to bottom-right). Ensure the order reflects a logical, meaningful sequence. - In SwiftUI, VoiceOver follows the view hierarchy by default. Use
accessibilitySortPriority(_:)
if you need to adjust traversal order. Avoid creating traversal loops or skipping elements during navigation.
Example
Consider the following example:
Error
- The
accessibilityTraversalAfter
property for the elements creates a cycle in linear traversal. This causes some elements to become unreachable. As a result, the screen reader may enter a traversal loop, navigating between the same elements in a circular manner and never reaching the rest of the elements.
Fix
- Make sure all the
accessibilityTraversalAfter
properties specify the order of focus logically by pointing to the next element that should be reached by the screen reader. - Make sure the focus order does not create traversal cycles and all elements are reachable by the screen reader. This ensures that screen readers do not miss elements or get stuck in traversal cycles.
References
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!