# Alternative Text (Mobile)

> In mobile apps, images, infographics, and other media must have a text alternative that assistive technologies can announce programmatically.

Source: https://knowledge.evinced.com/mobile/mobile-validations/alternative-text

Images, infographics, and other media must have a text alternative that assistive technologies can announce programmatically.

Provide a text alternative for each image or graphic, so assistive technologies can convey its purpose. Write the text alternative based on the image's role in context: describe its meaning and function, not every visual detail. When an image is exposed to assistive technologies but has no text alternative, screen readers announce only “*image*”, “*unlabeled*”, or on iOS sometimes the image's file name, and users miss the information the image conveys.

**Note:** If an image is purely decorative and adds no information or functionality, don't give it a text alternative. Hide it from assistive technologies instead, so screen readers skip it.

## Pass Patterns

### Android

**XML Views**

The image has a text alternative in `android:contentDescription`.

```xml
<ImageView
    android:id="@+id/logoImage"
    android:layout_width="..."
    android:layout_height="..."
    android:src="@drawable/..."
    android:contentDescription="Company logo" />
```

A decorative image is hidden from assistive technologies with `android:importantForAccessibility="no"`.

```xml
<ImageView
    android:id="@+id/dividerImage"
    android:layout_width="..."
    android:layout_height="..."
    android:src="@drawable/..."
    android:importantForAccessibility="no" />
```

**Jetpack Compose**

The image has a text alternative in `contentDescription`.

```kotlin
Image(
    painter = painterResource(R.drawable...),
    contentDescription = "Company logo",
)
```

A decorative image uses `contentDescription = null`, so assistive technologies skip it.

```kotlin
Image(
    painter = painterResource(R.drawable...),
    contentDescription = null,
)
```

### iOS

**UIKit**

The image view is an accessibility element with a text alternative in `accessibilityLabel`.

```swift
let logoImageView = UIImageView(image: UIImage(named: "..."))
logoImageView.isAccessibilityElement = true
logoImageView.accessibilityLabel = "Company logo"
```

**SwiftUI**

The image has a text alternative in `accessibilityLabel`.

```swift
if let uiImage = UIImage(data: imageData) {
    Image(uiImage: uiImage)
        .accessibilityLabel("Company logo")
}
```

A decorative image uses `Image(decorative:)`, so assistive technologies skip it.

```swift
Image(decorative: "divider")
```

### Cross Platform

**Flutter (Android)**

The image has a text alternative in `semanticLabel`.

```dart
Image.asset(
  'assets/...',
  semanticLabel: 'Company Logo',
  width: ...,
  height: ...,
)
```

**React Native**

The image is accessible and has a text alternative in `accessibilityLabel`.

```tsx
<Image
  source={require('...')}
  style={{ width: ..., height: ... }}
  accessible
  accessibilityLabel="Company logo"
/>
```

**React Native (Android)**

```tsx
<Image
  source={require('../../../assets/a11y.png')}
  style={styles.image}
  accessible
  accessibilityLabel="android logo"
  importantForAccessibility="yes"
/>
```

## Fail Patterns

### Android

**XML Views**

The image is exposed to assistive technologies, but it has no `contentDescription`.

```xml
<ImageView
    android:id="@+id/logoImage"
    android:layout_width="..."
    android:layout_height="..."
    android:focusable="true"
    android:src="@drawable/..."
    android:importantForAccessibility="yes"
    android:screenReaderFocusable="true" />
```

**Jetpack Compose**

The image can receive focus, but its `contentDescription` is empty.

```kotlin
Image(
    painter = painterResource(R.drawable.a11y),
    contentDescription = "",
    modifier = Modifier
        ...
        .semantics { contentDescription = "" }
        .focusable(),
)
```

### iOS

**UIKit**

The image view is an accessibility element, but it has no `accessibilityLabel`.

```swift
let logoImageView = UIImageView(image: UIImage(named: "..."))
logoImageView.isAccessibilityElement = true
```

**SwiftUI**

The image is created from data, so it has no name, and it has no `accessibilityLabel`.

```swift
Image(systemName: "...")
    .accessibilityElement()
    .accessibilityAddTraits(.isImage)
```

### Cross Platform

**Flutter (Android)**

The image has no `semanticLabel`.

```dart
child: Semantics(
  container: true,
  child: Focus(
    child: Image.asset(
      'assets/logo.png',
       width: 100,
       height: 100,
     ),
   ),
),
```

**React Native**

The image is accessible, but it has no `accessibilityLabel`.

```tsx
<Image
  source={require('...')}
  style={{ width: ..., height: ... }}
  accessible
/>
```

**React Native (Android)**

```tsx
<Pressable focusable>
  <Image
    source={require('../../../assets/a11y.png')}
    style={styles.image}
    accessible
    importantForAccessibility="yes"
  />
</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 image.
3.  Listen to what the screen reader announces.

**Expected results:** The screen reader announces a text alternative that conveys the image's purpose, or skips the image if it is decorative.

**Actual results:** The screen reader announces only “*image*” or “*unlabeled*”, or on iOS the image's file name.

### Using developer tools

1.  **iOS:** In Xcode, open **Xcode > Open Developer Tool > Accessibility Inspector**, select the simulator or device, and point at the image.
2.  **Android:** Go to the **Running devices** panel in Android Studio. Load the device screen and open the **Layout Inspector.** Find the attributes of the component and check that one of the following is true:
    1.  The `text` attribute is present and not empty and the field does not have `importantForAccessibility` set to false.
    2.  The `contentDescription` is present and not empty and the field does not have `importantForAccessibility` set to `false`.
    3.  A parent container meets the above 2 conditions if the element has `importantForAccessibility` set to `true`.

**Expected results:** In Accessibility Inspector, the image's **Label** shows its text alternative. Accessibility Scanner reports no item label issue for the image.

**Actual results:** The **Label** is empty.

## FAQ

**How does this issue relate to 1.1.1 Non-text Content?**

SC 1.1.1 requires non-text content to have a text alternative that serves the equivalent purpose. When an image is exposed to assistive technologies without a text alternative, screen reader users cannot perceive the information it conveys, so the criterion is not met. Decorative images are an exception, but they must be hidden from assistive technologies.

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

When an image conveys information or acts as a control, a missing text alternative makes its purpose invisible to screen reader users. They may miss key content or be unable to complete a task that depends on the image, so it is rated critical.

## Standards and Regulations

| Standard | Success Criterion | Reference |
| --- | --- | --- |
| WCAG 2.2 | [1.1.1 Non-text Content](https://www.w3.org/TR/WCAG22/#non-text-content) (A) | All non-text content that is presented to the user has a text alternative that serves the equivalent purpose, except for controls/input, time-based media, tests, sensory experiences, CAPTCHA, and decoration/formatting/invisible content. |
| EN 301 549 | [11.1.1.1 Non-text Content](https://www.etsi.org/standards/etsi-301-549) | Same as the WCAG text. |

## Personas impacted by this issue

-   [Screen Reader](https://knowledge.evinced.com/a11y-essentials/personas#screen-reader)
-   [Low Vision](https://knowledge.evinced.com/a11y-essentials/personas#low-vision)

## Learn More

-   [Understanding Non-text Content (W3C)](https://www.w3.org/WAI/WCAG22/Understanding/non-text-content.html)
-   [Images Tutorial (WAI)](https://www.w3.org/WAI/tutorials/images/)
-   [WAI website](https://www.w3.org/WAI/)
-   [Writing Effective Text Alternatives for Images](https://knowledge.evinced.com/a11y-essentials/writing-effective-text-alternatives-for-images)

## Related Issues

-   [accessible-name](https://knowledge.evinced.com/mobile/mobile-validations/accessible-name)
-   [icon-contrast](https://knowledge.evinced.com/mobile/mobile-validations/icon-contrast)
-   [ignored-by-assistive-technology](https://knowledge.evinced.com/mobile/mobile-validations/ignored-by-assistive-technology)
-   [instruction-in-name](https://knowledge.evinced.com/mobile/mobile-validations/instruction-in-name)
-   [meaningful-alternative-text](https://knowledge.evinced.com/mobile/mobile-validations/meaningful-alternative-text)
