I’m currently exploring VoiceOver accessibility in iOS and looking for the best way to reduce the number of swipes required to navigate a UITableView. I’ve come across a couple of potential solutions but am unsure which is preferred.
Solution 1: Grouping Subviews in Each Cell
- Combine all subviews inside a UITableViewCell into a single accessibility element.
- Provide a concise and meaningful accessibilityLabel.
- Use custom actions
(UIAccessibilityCustomAction)
or accessibilityActivationPoint to handle interactions on specific elements within the cell.
Solution 2: Using UIAccessibilityContainerDataTableCell
& UIAccessibilityContainerDataTable
- Implement
UIAccessibilityContainerDataTable
for structured table navigation. - Make each cell conform to
UIAccessibilityContainerDataTableCell,
defining its row and column positions. - However, I’m finding this approach a bit complex, and I need guidance on properly implementing these protocols.
- Additionally, in my case, VoiceOver is not navigating to Section 2—I’m not sure why.
Questions:
- Which of these approaches is generally preferred for better VoiceOver navigation?
- How do I properly implement
UIAccessibilityContainerDataTable
so that all sections and rows are navigable? - Any best practices or alternative recommendations?
Would really appreciate any insights or guidance!
Hey! Great question. My recommendation is Solution 1 you've outlined above.
If you have a table view cell with multiple, small, discrete elements, you should absolutely find ways to group them semantically.
It may mean the entire cell is 1 element, or a few like 2 or 3. This will not only help reduce the amount of swiping required to navigate your app, it will also make it easier for someone to understand your UI because elements will be grouped by information.
Check out this developer article. Mainly, the section "Group and declutter accessibility elements", https://developer.apple.com/news/?id=v56qu1b3
If you have specific questions about grouping the elements in your app, feel free to discuss here!