conflicting-traits
This element includes multiple iOS accessibility traits that contradict each other. This conflict can cause VoiceOver or Switch Control to behave incorrectly by announcing two incompatible roles or making a navigation gesture unresponsive.
Who might be affected
Screen Reader
Voice Control
Description
Traits that are in conflict can cause confusing behavior for people who use VoiceOver and Switch Control. Choose the one trait that best matches the element’s behavior, or split it into separate components so each has a single, clear role.
Fail Patterns
iOS
UIKit:
1 let label = UILabel()2 label.text = Self.sampleTitle3 ...4 label.isUserInteractionEnabled = true5 label.accessibilityTraits = [.button, .link]6 label.addGestureRecognizer(7 UITapGestureRecognizer(target: self, action: #selector(handleTap)),8 )
SwiftUI:
1 Text("Submit")2 ...3 .onTapGesture {4 ...5 }6 .accessibilityAddTraits([.isButton, .isLink])
Pass Patterns
iOS
UIKit:
1 let label = UILabel()2 label.text = Self.sampleTitle3 ...4 label.isUserInteractionEnabled = true5 label.accessibilityTraits = .button6 label.addGestureRecognizer(7 UITapGestureRecognizer(target: self, action: #selector(handleTap)),8 )
SwiftUI:
1 Text("Submit")2 ...3 .onTapGesture {4 ...5 }6 .accessibilityAddTraits(.isButton)
How Users Are Affected
| When | Is Combined With | The User |
|---|---|---|
| .adjustable | .causesPageTurn | encounters conflicting event handlers |
| .adjustable | .header | cannot navigate to this heading with the rotor |
| .allowsDirectInteraction | .button | cannot activate the component |
| .allowsDirectInteraction | .keyboardKey | cannot activate using the keyboard key |
| .allowsDirectInteraction | .link | cannot activate the link |
| .allowsDirectInteraction | .searchField | cannot activate the search field |
| .allowsDirectInteraction | .toggleButton | cannot activate the toggle button |
| .button | .link | cannot tell whether activation will leave the app |
| .button | .searchField | cannot tell what will happen on activation |
| .link | .searchField | cannot tell what will happen on activation |
WCAG Success criteria
This issue might cause elements to fail one or more of the following Success criteria:
4.1.2 Name, Role, Value (A)
1.3.1 Info and Relationships (A)