We'd like to set Google Analytics cookies to learn how people use the Knowledge Base, so we can improve it. We set them only if you accept.

Skip to main content
Digital Accessibility Knowledge Base

conflicting-type-in-label

Mobile validation

An element's accessible name must not include a type or role that conflicts with the element's actual role.

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.

XML
<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.

Swift
let submitButton = UIButton(type: .system)
submitButton.setTitle("Submit", for: .normal)

Cross Platform

The Semantics label identifies the checkbox, with no type in it.

Dart
Semantics(
  label: 'Agree',
  checked: false,
  child: Checkbox(
    value: false,
    onChanged: (_) {},
  ),
),

Fail Patterns

Android

XML Views

The contentDescription says “Checkbox”, but the element is a button.

XML
<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.

Swift
let submitButton = UIButton(type: .system)
submitButton.setTitle("Submit", for: .normal)
submitButton.accessibilityLabel = "Submit, image"

Cross Platform

The Semantics label says “Button”, but the element is a checkbox.

Dart
Semantics(
  label: 'Agree, Button',
  checked: false,
  child: Checkbox(
    value: false,
    onChanged: (_) {},
  ),
),

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

  1. Turn on VoiceOver on iOS, or TalkBack on Android.
  2. Swipe right or left to move to the element.
  3. 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

  1. 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.
  2. 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

StandardSuccess CriterionReference
WCAG 2.24.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 54911.4.1.2 Name, Role, ValueSame as the WCAG text.

Personas impacted by this issue