# Type In Label (Mobile)

> In mobile apps, don't include the control or view type in an element's accessible name.

Source: https://knowledge.evinced.com/mobile/mobile-validations/type-in-label

Don't include the control or view type in an element's `accessibilityLabel` or `contentDescription`.

Assistive technologies already convey an element's type through its built-in semantics, such as its role or traits. Screen readers announce the type by default, for example “*button*” or “*link*”. When the accessible name also contains the type, such as “*Submit button*”, screen readers announce it twice, which adds noise and slows users down. Voice input users may also have to include the extra word in their commands. Remove the type from the accessible name, and let the element's role be announced on its own.

**Note:** When the type in the name contradicts the element's actual role, for example “*Submit, link*” on a button, see the related [conflicting-type-in-label](https://knowledge.evinced.com/mobile/mobile-validations/conflicting-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" />
```

**Jetpack Compose**

The clickable element has the button role, and its name contains no type.

```kotlin
Text(
    text = "Submit",
    modifier = Modifier
        .semantics { role = Role.Button }
        .clickable { submit() },
)
```

### iOS

**UIKit**

The button's name comes from its title, with no type in it.

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

**SwiftUI**

The button's name comes from its label, with no type in it.

```swift
Button {
    submit()
} label: {
    Text("Submit")
}
```

### Cross Platform

**Flutter**

The button's name comes from its text, with no type in it.

```dart
ElevatedButton(
  onPressed: submit,
  child: const Text('Submit'),
),
```

**React Native**

The button's name comes from its text, with no type in it.

```tsx
<Pressable accessibilityRole="button" onPress={submit}>
  <Text>Submit</Text>
</Pressable>
```

## Fail Patterns

### Android

**XML Views**

The `contentDescription` repeats the type, “*Button*”.

```xml
<Button
    android:id="@+id/submitButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Submit"
    android:contentDescription="Submit, Button" />
```

**Jetpack Compose**

The `contentDescription` repeats the type, “*Button*”.

```kotlin
Text(
    text = "Submit",
    modifier = Modifier
        .semantics {
            role = Role.Button
            contentDescription = "Submit, Button"
        }
        .clickable { submit() },
)
```

### iOS

**UIKit**

The `accessibilityLabel` repeats the type, “*Button*”.

```swift
let submitButton = UIButton(type: .system)
submitButton.setTitle("Submit", for: .normal)
submitButton.accessibilityLabel = "Submit, Button"
```

**SwiftUI**

The button's label repeats the type, “*button*”.

```swift
Button {
    submit()
} label: {
    Text("Submit button")
}
```

### Cross Platform

**Flutter**

The `Semantics` label repeats the type, “*Button*”.

```dart
Semantics(
  label: 'Submit, Button',
  button: true,
  excludeSemantics: true,
  child: ElevatedButton(
    onPressed: submit,
    child: const Text('Submit'),
  ),
),
```

**React Native**

The `accessibilityLabel` repeats the type, “*Button*”.

```tsx
<Pressable
  accessibilityRole="button"
  accessibilityLabel="Submit, Button"
  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](https://knowledge.evinced.com/a11y-essentials/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 type once, for example “*Submit, button*”.

**Actual results:** The screen reader announces the type twice, once from the name and once from the element's role, for example “*Submit, button, button*”.

**Tip:** To hear the type more easily, set the screen reader to announce it first. On Android, open **TalkBack settings > Advanced settings > Element description order** and choose "Type, name, state". On iOS, open **Settings > Accessibility > VoiceOver > Verbosity > Controls** and choose "Speak Before".

### 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 name contains no type, such as “*button*”, “*link*”, or “*image*”.

**Actual results:** The name contains the element's type.

## FAQ

**Why is this issue marked as Minor?**

The element remains identifiable and operable. The repeated type only adds unnecessary words to the announcement, so the impact is limited, and it is rated minor.

## 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

-   [Voice Input](https://knowledge.evinced.com/a11y-essentials/personas#voice-input)
-   [Screen Reader](https://knowledge.evinced.com/a11y-essentials/personas#screen-reader)

## Learn More

-   [Apple Human Interface Guidelines: Guidelines for Creating Labels](https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/iPhoneAccessibility/Making_Application_Accessible/Making_Application_Accessible.html#//apple_ref/doc/uid/TP40008785-CH102-SW6)
-   [Android: Describe each UI element](https://developer.android.com/guide/topics/ui/accessibility/apps#describe-ui-element)
-   [Apple: accessibilityLabel (UIKit)](https://developer.apple.com/documentation/uikit/uiaccessibilityelement/accessibilitylabel)
-   [Apple: accessibilityLabel(\_:) (SwiftUI)](https://developer.apple.com/documentation/swiftui/view/accessibilitylabel%28_%3A%29-1d7jv)

## Related Issues

-   [conflicting-type-in-label](https://knowledge.evinced.com/mobile/mobile-validations/conflicting-type-in-label)
-   [instruction-in-name](https://knowledge.evinced.com/mobile/mobile-validations/instruction-in-name)
-   [state-in-name](https://knowledge.evinced.com/mobile/mobile-validations/state-in-name)
