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

accessible-name-starts-with-label

Mobile validation

For any element with a visible label, start the accessible name with that label, so assistive technologies match what users see.

Many elements have both a visible label and an accessible name, the programmatic name that assistive technologies use. Voice control users activate elements by speaking what they see on screen, and voice control software works best when the spoken words match the start of the accessible name. Make sure the accessible name contains the visible label and, whenever possible, begins with it. The simplest way is to not override the name at all, so it comes from the visible label.

Note: This validation covers names that contain the visible label but don't start with it. When the accessible name does not contain the visible label at all, see the related label-in-name validation.

Pass Patterns

Android

XML Views

The button has no contentDescription, so its accessible name is its visible text, "Order".

XML
<Button
    android:layout_width="..."
    android:layout_height="..."
    android:layout_gravity="center"
    android:text="Order" />

iOS

The accessibilityLabel "Order items" starts with the visible title, "Order".

Swift
let orderButton = UIButton(type: .system)
orderButton.setTitle("Order", for: .normal)
orderButton.accessibilityLabel = "Order items"

Cross Platform

The semanticsLabel "Order items" starts with the visible text, "Order".

Dart
ElevatedButton(
  onPressed: placeOrder,
  child: const Text('Order', semanticsLabel: 'Order items'),
),

Fail Patterns

Android

XML Views

The contentDescription "Place order" contains the visible text, "Order", but doesn't start with it.

XML
<Button
    android:layout_width="..."
    android:layout_height="..."
    android:text="Place order"
    android:contentDescription="Order" />

iOS

The accessibilityLabel "Place order" contains the visible title, "Order", but doesn't start with it.

Swift
let orderButton = UIButton(type: .system)
orderButton.setTitle("Order", for: .normal)
orderButton.accessibilityLabel = "Place order"

Cross Platform

The semanticsLabel "Place order" contains the visible text, "Order", but doesn't start with it.

Dart
ElevatedButton(
  onPressed: placeOrder,
  child: const Text('Order', semanticsLabel: 'Place order'),
),

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.

Expected results: The name shown for each element starts with the element's visible label.

Actual results: The name shown contains the visible label later in the text, for example “Place order” for a button labeled “Order”.

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 starts with the visible label.

Actual results: The accessible name starts with other words, and the visible label appears only later.

FAQ

Why is this issue marked as Best Practice?

The visible label is still part of the accessible name, so voice control users can usually still activate the element. However, the mismatch at the start of the name can make voice commands less reliable, and users may need to try other commands, so it is rated best practice.

Standards and Regulations

This issue is classified as "Best Practice," meaning it isn't tied to a specific WCAG success criterion or any other regulation or standard; however it still affects the experience of some users. These issues fall outside formal compliance requirements, yet addressing them improves usability and accessibility in practice.

Personas impacted by this issue

Learn More