RoyalPineapple/A11yOrderTesting

★ 0Forks 0SwiftGitHub ↗Compare

README

iOS VoiceOver Element Ordering Test

The Problem

When building accessible iOS applications, understanding how VoiceOver determines the reading order of elements is crucial for creating intuitive user experiences. This project specifically investigates the spatial thresholds that influence VoiceOver's reading order in a native UIView hierarchy.

Our key focus is on a specific scenario: When elements are horizontally adjacent but vertically offset, at what point does VoiceOver prioritize the vertical position over the horizontal position?

The Challenge

While investigating this behavior, we encountered an interesting technical hurdle. When working with vanilla UIViews, even on a physical device, both the accessibilityElements array property and the accessibilityElementAtIndex API return nil. This makes it challenging to programmatically determine VoiceOver's reading order.

Our Solution

We developed a clever workaround using accessibility notifications to determine the actual reading order:

  1. Post a layout changed notification to the parent container view
  2. This triggers VoiceOver to select the first element, firing the element selected notification
  3. Capture the selected view and temporarily disable its accessibility
  4. Repeat the process to discover the next element in the sequence
  5. Continue until all elements are discovered

Using this approach, we created an automated testing system that:

  • Incrementally increases the vertical distance between elements
  • Records when the reading order changes
  • Works across different device types and size classes

Key Findings

Our testing revealed:

  • The vertical offset threshold varies by device type:
    • iPhone: 8 points
    • iPad: 13 points

Interestingly, we found that these thresholds remain consistent regardless of size classes, suggesting that the differentiation is based on the device interface paradigm rather than the display characteristics.

Implications

Understanding these thresholds is crucial for:

  • Designing accessible layouts
  • Ensuring predictable VoiceOver navigation
  • Creating consistent experiences across iOS devices

Contributing

Feel free to contribute to this research by testing on different devices or iOS versions. We're particularly interested in:

  • Verification of thresholds across different iOS versions
  • Testing on different device models
  • Additional edge cases or scenarios

Contributors

RoyalPineapple

Issues