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.sampleTitle
3 ...
4 label.isUserInteractionEnabled = true
5 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.sampleTitle
3 ...
4 label.isUserInteractionEnabled = true
5 label.accessibilityTraits = .button
6 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

WhenIs Combined WithThe User
.adjustable.causesPageTurnencounters conflicting event handlers
.adjustable.headercannot navigate to this heading with the rotor
.allowsDirectInteraction.buttoncannot activate the component
.allowsDirectInteraction.keyboardKeycannot activate using the keyboard key
.allowsDirectInteraction.linkcannot activate the link
.allowsDirectInteraction.searchFieldcannot activate the search field
.allowsDirectInteraction.toggleButtoncannot activate the toggle button
.button.linkcannot tell whether activation will leave the app
.button.searchFieldcannot tell what will happen on activation
.link.searchFieldcannot 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)