[ad_1]
I am developing a custom control where I am facing this conundrum.
The control has this hierarchy:
Self (the one I am developing) – UIView derived custom control. I am setting isAccessibilityElement = false
Container – UIView. Again, isAccessibilityElement = false
Children – Again, UIView derived custom controls, whose isAccessibilityElement = false
Every child has labels and buttons that must be accessible.
I have a swipe gesture wired to Self, that should navigate between children.
Everything works great without Voiceover.
When the voiceover is ON, the swiping does not work.
I have tried every trick in the book setting self.accessibilityTraits to .allowsDirectInteraction, .adjustable and so on.
The only time swipe works is when I set self.isAccessibilityElement = true on the control itself. This obviously makes the children inaccessible for speaking as well as focusing and tapping.
I have also tried overriding accessibilityActivate(), but it doesn’t enable swipe as it should. accessibilityIncrement() and accessibilityDecrement() also fails, along with .adjustable trait.
This being a common design pattern, it seems to me I am missing something very crucial w.r.t. how isAccessibilityElement works with gestures and children views. I am unable to find it in the docs, and wherever I have tried, it doesn’t work as expected.
[ad_2]