conflicting-type-in-label
Mobile validation
An element's accessible name should describe its purpose, not its control type. Assistive technologies already announce the element's role, such as “button” or “checkbox”, from its programmatic role. In this case, the accessible name contains a type that contradicts that role, for example “Submit, link” on a button. Screen readers then announce two different types for the same element, and users may misinterpret what it is and how to operate it. Voice control users may also have to include the wrong type in their commands. Remove the type from the accessible name, and let the element's role be announced on its own.
Note: Even a type that matches the element's role should not be part of the name, because it is announced twice. See the related type-in-label validation.
Pass Patterns
Android
XML Views
The button's name comes from its text, with no type in it.
<Button
android:id="@+id/submitButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit" />iOS
The button's name comes from its title, with no type in it.
let submitButton = UIButton(type: .system)
submitButton.setTitle("Submit", for: .normal)The button's name comes from its title, with no type in it.
Button("Submit") {
submit()
}Cross Platform
The Semantics label identifies the checkbox, with no type in it.
Semantics(
label: 'Agree',
checked: false,
child: Checkbox(
value: false,
onChanged: (_) {},
),
),The accessibilityLabel identifies the button, with no type in it.
<Pressable
accessibilityRole="button"
accessibilityLabel="Submit"
onPress={submit}
>
<Text>Submit</Text>
</Pressable>Fail Patterns
Android
XML Views
The contentDescription says “Checkbox”, but the element is a button.
<Button
android:id="@+id/submitButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit"
android:contentDescription="Submit, Checkbox" />iOS
The accessibilityLabel says “image”, but the element is a button.
let submitButton = UIButton(type: .system)
submitButton.setTitle("Submit", for: .normal)
submitButton.accessibilityLabel = "Submit, image"The accessibilityLabel says “image”, but the element is a button.
Button("Submit") {
submit()
}
.accessibilityLabel("Submit, image")Cross Platform
The Semantics label says “Button”, but the element is a checkbox.
Semantics(
label: 'Agree, Button',
checked: false,
child: Checkbox(
value: false,
onChanged: (_) {},
),
),The accessibilityLabel says “image”, but the element is a button.
<Pressable
accessibilityRole="button"
accessibilityLabel="Submit, image"
onPress={submit}
>
<Text>Submit</Text>
</Pressable>Try It Yourself
Using a screen reader
New to screen reader testing, or need a refresher?
Review this article first: Practical guides for using screen readers
- Turn on VoiceOver on iOS, or TalkBack on Android.
- Swipe right or left to move to the element.
- Listen to the element's name and its role.
Expected results: The screen reader announces the element's name and a single role, for example “Submit, button”.
Actual results: The screen reader announces two different types, one from the name and one from the element's role, for example “Submit, link, button”.
Using developer tools
- iOS: In Xcode, open Xcode > Open Developer Tool > Accessibility Inspector, select the simulator or device, and point at the element. Compare its Label with its Traits.
- Android: In Android Studio, open the Layout Inspector and select the element. Compare its
contentDescription, for Views, or its semantics, for Jetpack Compose, with the element's type.
Expected results: The name contains no type, such as “button”, “link”, or “checkbox”.
Actual results: The name contains a type that contradicts the element's actual role.
FAQ
How does this issue relate to 4.1.2 Name, role, value?
SC 4.1.2 requires the name and role of every user interface component to be programmatically determinable. When the name contains a type that contradicts the actual role, assistive technologies receive conflicting information, and users cannot reliably determine what the element is.
Why is this issue marked as Serious?
Screen readers announce both the false type from the name and the actual role of the element. Users may misinterpret what the control is and how to operate it, for example expecting a link to open a new page when it is a button that submits a form, so it is rated serious.
Standards and Regulations
| Standard | Success Criterion | Reference |
|---|---|---|
| WCAG 2.2 | 4.1.2 Name, Role, Value (A) | For all user interface components, the name and role can be programmatically determined; states, properties, and values that can be set by the user can be programmatically set; and notification of changes to these items is available to assistive technologies. |
| EN 301 549 | 11.4.1.2 Name, Role, Value | Same as the WCAG text. |