'How to setup accessibility containers so that gestures work properly?
I have a view controller with this layout (note that yellow and table views are siblings):
I want the yellow view to act as a container, so I'm doing this in viewDidLoad:
yellowView.isAccessibilityElement = true
view.accessibilityElements = [yellowView!, tableView!]
When in Voice Over, I select "Containers" from the accessibility rotor and expect to be able to swipe up and down to move from the yellow view to the table view and back again:
Yellow (swipe down) → TableView (swipe down) → Tabbar (swipe up) → tableView (swipe up) → Yellow
However, this is not the case - after the tableView gains focus, swiping up does not move focus to the yellow view, it just stops there. Swiping down, moves to the tabbar - it seems that my custom view is ignored as container.
I have experimented with many combinations of adding superviews and setting isAccessibilityElement = false to them, but nothing seems to work.
Does anybody know how to solve this?
Solution 1:[1]
Did you set an accessibilityLabel on the yellowView or try changing the accessibilityContainerType = .semantic?
I think VoiceOver is not finding yellowView because the rotor is looking for UIAccessibilityContainer but the default container type is .none for UIView. However, a UITableView has a default container type of .semantic.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mary Martinez |

