Reputation: 1
I'm writing a my first Swift app and want to use the convenient DisclosureGroups provided by SwiftUI. However I'm using the onTapGesture for the label to take me to another view and relegating the expand/collapse toggling to a button. While running VoiceOver for it though I noticed that all elements in the Disclosure Group label have their accessibility labels appended with "Double-Tap to Expand/Collapse" (depending on the isExpanded property). With my use case this is not true and would like to remove this additional line.
However I cannot find away to do this. Even setting up a simple dummy app and using any and every combination of the the. accessibility modifiers (hint, removeTraits, label, Element) results in the line still being included. The only way Ive gotten it to stop is .accessibilityHidden, but that shuts down even being able to focus on anything in the label with VoiceOver so that's a non starter.
import SwiftUI
struct ContentsView: View{
var body: some View {
DisclosureGroup( content: {Text("Content, does not have extra reading")},
label: { Text("Label, can't get rid of extra reading")}
)
}
}
Is there ANY way to disable this default string? Or is this just a case of me trying to use it for something that it's not and I'm better off writing my own DisclosureGroup?
Upvotes: 0
Views: 72