I have a parent view containing 10 subviews. To control the VoiceOver navigation order, I set only a few elements in accessibilityElements.
However, the remaining elements are not being focused or are completely inaccessible.
Is this the expected behavior? If I only specify a subset of elements in accessibilityElements, does it exclude the rest? What’s the best way to ensure all elements remain accessible while customising the order?
Yes, when you set the accessibilityElements
property on a view, only the elements included will be accessible to features like VoiceOver, Switch Control, Voice Control, etc.
You're right, however, that you can use this property to manually specify element ordering. But you also must remember to include all of the elements if that is your desire.
Before you override and set the accessibilityElements
property, you can use this same property to poll what all the elements are, and then order them this way as you wish. Does trying something like this help?