Custom tab bar in SwiftUI

I made a (very simple) custom tab bar in SwiftUI. It's simply an HStack containing two buttons. These buttons control the selection of a paged TabView. This works well, but in VoiceOver they don't behave like the bottom tab bar or e.g. a segmented picker. Specifically, VoiceOver does not say something like "tab one of two" when the first button is focused.

According to my research, in UIKit this can be accomplished by giving the container view the accessibility trait tabBar, hiding it as an accessibility element and give it the accessibility container type semanticGroup.

In SwiftUI, there is also the trait isTabBar, but that does not seem to have any impact for VoiceOver. I don't see an equivalent of semanticGroup in SwiftUI. I tried accessibilityElement(children: .contain) but that also does not seem to have any impact.

So, is there any way in SwiftUI to make a button behave like a tab-button in VoiceOver? And how is SwiftUI's isTabBar accessibility trait supposed to be used?

Hello, this may be a bug. Thanks for your help raising awareness, please take a few extra minutes and paste this issue into a bug report so we can confirm this is tracked in our internal system: https://developer.apple.com/bug-reporting/

Once you do, feel free to let me know the Feedback ID number

Bug report submitted under FB19401153.

Custom tab bar in SwiftUI
 
 
Q