# Conflicting Type In Label (Mobile)

> In mobile apps, an element's accessible name must not include a type or role that conflicts with the element's actual role.

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

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](https://knowledge.evinced.com/mobile/mobile-validations/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

**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 title, with no type in it.

```swift
Button("Submit") {
    submit()
}
```

### Cross Platform

**Flutter (Android)**

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

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

**React Native**

The `accessibilityLabel` identifies the button, with no type in it.

```tsx
<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.

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

### iOS

**UIKit**

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"
```

**SwiftUI**

The `accessibilityLabel` says “*image*”, but the element is a button.

```swift
Button("Submit") {
    submit()
}
.accessibilityLabel("Submit, image")
```

### Cross Platform

**Flutter (Android)**

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

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

**React Native**

The `accessibilityLabel` says “*image*”, but the element is a button.

```tsx
<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](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 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

| Standard | Success Criterion | Reference |
| --- | --- | --- |
| WCAG 2.2 | [4.1.2 Name, Role, Value](https://www.w3.org/TR/WCAG22/#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](https://www.etsi.org/standards/etsi-301-549) | Same as the WCAG text. |

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

## Related Issues

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