import SwiftUI
struct ContentView: View {
@State private var showingConfirmationDialog = false
@State private var options = ["Option 1", "Option 2", "Option 3"]
var body: some View {
Button("Show Options") {
showingConfirmationDialog = true
}
.confirmationDialog("Choose an Option", isPresented: $showingConfirmationDialog, titleVisibility: .visible) {
ForEach(options, id: .self) { option in
Button(option) {
print("(option) selected")
}
.accessibilityLabel(option) // Ensure VoiceOver reads the title
.accessibilityTraits([.isLink]) // Mark it as a link
.accessibilityRemoveTraits([.isButton])
}
Button("Cancel", role: .cancel) {
print("Cancel selected")
}
.accessibilityLabel("Cancel the action")
}
}
}
Using confirmationDialog(:)
Want to read confirmationDialog button as link but its reading as button.
Any possible way to change it?