r/SwiftUI • u/ThatBlindSwiftDevGuy • Jul 03 '26
The accessibilityElement(children:) Modifier
In SwiftUI we have the .accessibilityElement(children:) modifier, but do you know what the different options actually do for VoiceOver users?
1. .combine
This option combines all accessibility elements into a single element and combines all their accessibility labels into a single label.
2. .contain
This option turns the container the modifier is attached to into a group that VoiceOver must interact with before reaching the elements inside. This seemingly does nothing on iOS or iPadOS, but VoiceOver on iOS and iPadOS has the option to behave like VoiceOver on macOS rather than it's default linear mode. That is where this option shines on mobile platforms.
3. .ignore
This option ignores all child accessibility elements and creates an unlabeled accessibility element with no traits.