VoiceOver ignores Button label when combined with other Views

VoiceOver seems to ignore the label of a button when it is combined with other views. Let's take the following example:
Code Block swift
VStack {
Text("Title")
Button(action: increment) {
Text("My Primary Button")
}
}
.accessibilityElement(children: .combine)

I would expect VoiceOver to read "Title, My Primary Button, Button".

However it reads "Title, Button" instead, ignoring the button's label.

To make it read the button's label, you can use the following code:
Code Block swift
VStack {
Text("Title")
Button(action: increment) {
Text("My Primary Button")
}
.accessibility(removeTraits: .isButton)
}
.accessibilityElement(children: .combine)
.accessibility(addTraits: .isButton)

Now, I don't think this is really how it's supposed to work. Or am I missing something? Is this a SwiftUI "bug"?

Button text isn't used when children are combined, they get added as custom actions to the newly combined element. So what you end up with is a new element, with "Title" as the label and a custom action named "My Primary Button". Your workaround is correct if you want to have the button text included, alternatively you can set a new label on the combined element.
VoiceOver ignores Button label when combined with other Views
 
 
Q