Reputation: 11
I have a situation where the Accessibility VoiceOver just does not work.
I have a customView having a UIImage
(imageSample) and a UILabel
(labelSample)
This same CustomView
is used at two different screens within the app.
Screen 1 — This works!
View -> MainScrollView
-> MainStackView
-> OptionAStackView
-> CustomView
Screen 2 — This does NOT work!
View -> MainScrollView
-> MainStackView
-> ContainerView
-> StackView
-> StackView
-> OptionBStackView
-> CustomView
The voiceOver for the label works on Screen 1 but fails on Screen 2. Does anyone have ideas on why VoiceOver would fail on Screen 2? Does the layout having multiple stack views affect VoiceOver? Does voiceover has issues handling multiple stack views.
Note: Accessibility is enabled for the UI label. And disabled for the view above this label in the hierarchy.
Upvotes: 1
Views: 2046
Reputation: 3040
Accessibility is finicky when working with objects that are heavily layered. If multiple subviews of your MainScrollView
have .isAccessibilityElement
set to true
, then it is possible that a view located below your customView
is the one that is being selected. To check if this is the case, you can tap your second screen to place the focus on the screen and then swipe right to continue moving the focus through the view hierarchy. If you manage to eventually reach the contentView
on your second screen, then you know that the focus is initially landing on a different layer than you wanted.
My guess is that the ContainerView
is the initial landing location of the focus. If you set ContainerView.isAccessibilityElement = false
, this might be able to solve your problem.
Upvotes: 2