Example code:
struct ContentView: View {
@State var isSelected = false
var body: some View {
VStack {
Button("Button1") {
}
Button(action: {
}, label: {
Image(systemName: "checkmark.square")
})
.accessibilityRepresentation {
Toggle("", isOn: $isSelected)
}
Button("Button3") {
}
}
.padding()
}
}
There are three buttons in the view, the middle button I want to custom Toggle and using accessibilityRepresentation
replace accessibility elements.
But using keyboard navigation (System settings -> Keyboard -> Keyboard navigation) VocieOver can't read the middle button. (VoiceOver key can read it)
If not use accessibilityRepresentation
, the keyboard navigation works
How to make keyboard navigation read the accessibilityRepresentation
elements?