Closed marco-mattei-mo closed 1 year ago
Hello, I am using this package in an app and I realised that the active
NavBarItem
isn't recognized as selected by VoiceOver. It would be nice to add the.isSelected
accessibility trait to the selectedNavBarItem
.I would propose something like this on the
NavBarItem
button:.accessibilityAddTraits(id == selection ? .isSelected : [])
I don't think it's possible to do it from outside the package, I tried dynamically adding the trait to the
pagerTabItem
according to the$selection
binding, like this:.pagerTabItem { Text("Any title") .frame(maxWidth: .infinity, maxHeight: .infinity) .accessibilityAddTraits(currentTab == 0 ? .isSelected: []) }
But I think the view set in here is not redrawn, the PagerTabStripView will only draw the one received on initialisation.
Hi! Thanks to use our framework! Regarding with your request: With the latest updates you can setup in each pagerTabItem the corresponding tag. So now is possible to add the selected trait from outside the package (the same way you handle it in the example you gave).
Here is the part of the Readme document where you can see how to setup the tag:
To specify the initial selected page you can pass the selection
init parameter (for it to work properly this value have to be equal to some tag value of the tab items).
struct MyPagerView: View {
@State var selection = 1
var body: some View {
PagerTabStripView(selection: $selection) {
MyFirstView()
.pagerTabItem(tag: 1) {
TitleNavBarItem(title: "Tab 1")
}
...
..
.
}
}
}
Hello, I am using this package in an app and I realised that the active
NavBarItem
isn't recognized as selected by VoiceOver. It would be nice to add the.isSelected
accessibility trait to the selectedNavBarItem
.I would propose something like this on the
NavBarItem
button:I don't think it's possible to do it from outside the package, I tried dynamically adding the trait to the
pagerTabItem
according to the$selection
binding, like this:But I think the view set in here is not redrawn, the PagerTabStripView will only draw the one received on initialisation.