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

label-in-name

Mobile validation

The accessible name of an interactive element must include its visible label.

Many elements have both a visible label and an accessible name, the programmatic name that assistive technologies use. Voice input users activate elements by speaking the words they see on screen. When the accessible name does not include the visible label, those words do not match the element, and users cannot find or activate it by voice. Screen reader users who can also see the screen hear a name that differs from what is shown. Include the visible label text, in the same order, in the accessible name. You can add extra context after the label. The simplest way is to not override the name at all, so it comes from the visible label.

Note: It is best to start the accessible name with the visible label. When the name contains the label but does not start with it, see the related accessible-name-starts-with-label validation.

Pass Patterns

Android

XML Views

The button has no contentDescription, so its accessible name is its visible text, “Refresh”.

XML
<Button
    android:id="@+id/refreshButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Refresh" />

iOS

The accessibilityLabel “Refresh the list” includes the visible title, “Refresh”.

Swift
let refreshButton = UIButton(type: .system)
refreshButton.setTitle("Refresh", for: .normal)
refreshButton.accessibilityLabel = "Refresh the list"

Cross Platform

The semanticsLabel “Refresh the list” includes the visible text, “Refresh”.

Dart
ElevatedButton(
  onPressed: refresh,
  child: const Text('Refresh', semanticsLabel: 'Refresh the list'),
),

Fail Patterns

Android

XML Views

The contentDescription “Reload” does not include the visible text, “Refresh”.

XML
<Button
    android:id="@+id/refreshButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Refresh"
    android:contentDescription="Reload" />

iOS

The accessibilityLabel “Reload” does not include the visible title, “Refresh”.

Swift
let refreshButton = UIButton(type: .system)
refreshButton.setTitle("Refresh", for: .normal)
refreshButton.accessibilityLabel = "Reload"

Cross Platform

The semanticsLabel “Reload” does not include the visible text, “Refresh”.

Dart
ElevatedButton(
  onPressed: refresh,
  child: const Text('Refresh', semanticsLabel: 'Reload'),
),

Try It Yourself

Using voice input

New to voice input testing, or need a refresher?
Review this article first: Practical guides for using voice input

  1. Turn on Voice Control on iOS, or Voice Access on Android. On Android, make sure Voice Access is listening, from the notifications panel.
  2. Say “Show names” on iOS, or “Show labels” on Android.
  3. Compare the name shown for each element with its visible label.
  4. Say “Tap” followed by the element's visible label, for example “Tap Refresh”.

Expected results: The name shown for each element includes its visible label, and the element is activated when you say its visible label.

Actual results: The name shown does not include the visible label, for example “Reload” for a button labeled “Refresh”, and saying the visible label does not activate the element.

Using developer tools

  1. iOS: In Xcode, open Xcode > Open Developer Tool > Accessibility Inspector, select the simulator or device, and point at the element. Check its Label.
  2. Android: In Android Studio, open the Layout Inspector and select the element. Check its contentDescription, for Views, or its semantics, for Jetpack Compose.

Expected results: The accessible name is empty, so the visible label is used, or it includes the visible label.

Actual results: The accessible name does not include the visible label.

FAQ

How does this issue relate to 2.5.3 Label in Name?

SC 2.5.3 requires that for user interface components with a visible text label, the accessible name contains that text. When the accessible name does not include the visible label, voice input users cannot activate the element by speaking what they see, so the criterion is not met.

Why is this issue marked as Serious?

Voice input users rely on the words on screen to find and activate controls. When the accessible name does not include them, users may be unable to operate the control by voice, and need slower workarounds, such as showing numbers or a grid. This can block common tasks, so it is rated serious.

Standards and Regulations

StandardSuccess CriterionReference
WCAG 2.22.5.3 Label in Name (A)For user interface components with labels that include text or images of text, the accessible name contains the text that is presented visually.
EN 301 54911.2.5.3 Label in NameSame as the WCAG text.

Personas impacted by this issue

Learn More