# Unique Option Names (Mobile)

> In mobile apps, options in a collection should have unique names, so assistive technology users can tell them apart and activate the right one.

Source: https://knowledge.evinced.com/mobile/mobile-validations/unique-option-names

Use unique names for the options in a collection, so people who use assistive technologies can understand, distinguish, and activate them.

Each option in a collection, such as a radio group, a list of choices, or a set of tabs, needs an accessible name. The names must also be unique within the same collection. When two options share a name, screen reader users cannot tell them apart, and voice input users cannot activate the one they want by speaking its name.

**Note:** This validation covers options within the same collection. For other controls on the screen that share a name, see the related [duplicate-name](https://knowledge.evinced.com/mobile/mobile-validations/duplicate-name) validation.

## Pass Patterns

### Android

**XML Views**

Each radio button in the group has a unique name.

```xml
<RadioGroup
    android:layout_width="..."
    android:layout_height="..."
    android:orientation="vertical">


    <RadioButton
        android:layout_width="..."
        android:layout_height="..."
        android:text="Small" />


    <RadioButton
        android:layout_width="..."
        android:layout_height="..."
        android:text="Large" />


    <RadioButton
        android:layout_width="..."
        android:layout_height="..."
        android:text="Extra large" />
</RadioGroup>
```

**Jetpack Compose**

Each option in the radio group has a unique name.

```kotlin
val sizes = listOf("Small", "Large", "Extra large")


Column(Modifier.selectableGroup()) {
    sizes.forEach { size ->
        Row(
            modifier = Modifier.selectable(
                selected = selectedSize == size,
                onClick = { selectedSize = size },
                role = Role.RadioButton,
            ),
        ) {
            RadioButton(selected = selectedSize == size, onClick = null)
            Text(size)
        }
    }
}
```

### Cross Platform

**Flutter (Android)**

Each option in the radio group has a unique name.

```dart
const sizes = ['Small', 'Large', 'Extra large'];


Column(
  children: [
    for (final size in sizes)
      RadioListTile<String>(
        value: size,
        groupValue: selectedSize,
        onChanged: selectSize,
        title: Text(size),
      ),
  ],
),
```

**React Native (Android)**

Each option in the radio group has a unique name.

```tsx
const sizes = ['Small', 'Large', 'Extra large'];


<View accessibilityRole="radiogroup">
  {sizes.map((size) => (
    <Pressable
      key={size}
      accessibilityRole="radio"
      accessibilityState={{ checked: selectedSize === size }}
      accessibilityLabel={size}
      onPress={() => setSelectedSize(size)}
    >
      <Text>{size}</Text>
    </Pressable>
  ))}
</View>
```

## Fail Patterns

### Android

**XML Views**

Two radio buttons in the same group are both named “*Large*”.

```xml
<RadioGroup
    android:layout_width="..."
    android:layout_height="..."
    android:orientation="vertical">


    <RadioButton
        android:layout_width="..."
        android:layout_height="..."
        android:text="Small" />


    <RadioButton
        android:layout_width="..."
        android:layout_height="..."
        android:text="Large" />


    <RadioButton
        android:layout_width="..."
        android:layout_height="..."
        android:text="Large" />
</RadioGroup>
```

**Jetpack Compose**

Two options in the same radio group are both named “*Large*”.

```kotlin
val sizes = listOf("Small", "Large", "Large")


Column(Modifier.selectableGroup()) {
    sizes.forEachIndexed { index, size ->
        Row(
            modifier = Modifier.selectable(
                selected = selectedIndex == index,
                onClick = { selectedIndex = index },
                role = Role.RadioButton,
            ),
        ) {
            RadioButton(selected = selectedIndex == index, onClick = null)
            Text(size)
        }
    }
}
```

### Cross Platform

**Flutter (Android)**

Two options in the same radio group are both named “*Large*”.

```dart
const sizes = ['Small', 'Large', 'Large'];


Column(
  children: [
    for (var i = 0; i < sizes.length; i++)
      RadioListTile<int>(
        value: i,
        groupValue: selectedIndex,
        onChanged: selectIndex,
        title: Text(sizes[i]),
      ),
  ],
),
```

**React Native (Android)**

Two options in the same radio group are both named “*Large*”.

```tsx
const sizes = ['Small', 'Large', 'Large'];


<View accessibilityRole="radiogroup">
  {sizes.map((size, index) => (
    <Pressable
      key={index}
      accessibilityRole="radio"
      accessibilityState={{ checked: selectedIndex === index }}
      accessibilityLabel={size}
      onPress={() => setSelectedIndex(index)}
    >
      <Text>{size}</Text>
    </Pressable>
  ))}
</View>
```

## 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 through the options in a collection, such as a radio group or a set of tabs.
3.  Listen to the name of each option.

**Expected results:** Each option in the collection has a different name.

**Actual results:** Two or more options in the same collection are announced with the same name.

### Using voice input

**New to voice input testing, or need a refresher?**  
Review this article first: [Practical guides for using voice input](https://knowledge.evinced.com/a11y-essentials/practical-guides-for-using-voice-input)

1.  Turn on Voice Control on iOS, or Voice Access on Android.
2.  Say “*Show names*” on iOS, or “*Show labels*” on Android.
3.  Check the names shown for the options in each collection.

**Expected results:** Each option shows a unique name that you can say to select it.

**Actual results:** Several options show the same name, so it cannot be used to select a specific one.

## FAQ

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

Users can usually still select the options, but they may need extra effort to tell them apart, or may pick the wrong one. It affects clarity and efficiency rather than blocking a task, so it is rated minor.

**How does this issue relate to 4.1.2 Name, Role, Value**

WCAG success criterion 4.1.2 requires each user interface component to expose a programmatic `name`, `role`, and current `state` or `value` so assistive technology can understand and operate it.

When two options in the same collection share an accessible name, their `name` is not programmatically distinguishable within that set. Assistive technology will announce identical items, and voice input users cannot activate the intended option by speaking its name. Giving each option a unique accessible name within its collection supports conformance with 4.1.2.

## 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. |
| Section 508 | [1194.21(d)](https://www.federalregister.gov/documents/2018/01/18/2018-00712/section-508-standards-update#d21) | Sufficient information about a user interface element including the identity, operation and state of the element shall be available to assistive technology. When an image represents a program element, the information conveyed by the image must also be available in 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

-   [accessible-name](https://knowledge.evinced.com/mobile/mobile-validations/accessible-name)
-   [duplicate-name](https://knowledge.evinced.com/mobile/mobile-validations/duplicate-name)
