alternative-text
Mobile validation
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
The image has a text alternative in android:contentDescription.
<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".
<ImageView
android:id="@+id/dividerImage"
android:layout_width="..."
android:layout_height="..."
android:src="@drawable/..."
android:importantForAccessibility="no" />The image has a text alternative in contentDescription.
Image(
painter = painterResource(R.drawable...),
contentDescription = "Company logo",
)A decorative image uses contentDescription = null, so assistive technologies skip it.
Image(
painter = painterResource(R.drawable...),
contentDescription = null,
)iOS
The image view is an accessibility element with a text alternative in accessibilityLabel.
let logoImageView = UIImageView(image: UIImage(named: "..."))
logoImageView.isAccessibilityElement = true
logoImageView.accessibilityLabel = "Company logo"The image has a text alternative in accessibilityLabel.
if let uiImage = UIImage(data: imageData) {
Image(uiImage: uiImage)
.accessibilityLabel("Company logo")
}A decorative image uses Image(decorative:), so assistive technologies skip it.
Image(decorative: "divider")Cross Platform
The image has a text alternative in semanticLabel.
Image.asset(
'assets/...',
semanticLabel: 'Company Logo',
width: ...,
height: ...,
)The image is accessible and has a text alternative in accessibilityLabel.
<Image
source={require('...')}
style={{ width: ..., height: ... }}
accessible
accessibilityLabel="Company logo"
/><Image
source={require('../../../assets/a11y.png')}
style={styles.image}
accessible
accessibilityLabel="android logo"
importantForAccessibility="yes"
/>Fail Patterns
Android
The image is exposed to assistive technologies, but it has no contentDescription.
<ImageView
android:id="@+id/logoImage"
android:layout_width="..."
android:layout_height="..."
android:focusable="true"
android:src="@drawable/..."
android:importantForAccessibility="yes"
android:screenReaderFocusable="true" />The image can receive focus, but its contentDescription is empty.
Image(
painter = painterResource(R.drawable.a11y),
contentDescription = "",
modifier = Modifier
...
.semantics { contentDescription = "" }
.focusable(),
)iOS
The image view is an accessibility element, but it has no accessibilityLabel.
let logoImageView = UIImageView(image: UIImage(named: "..."))
logoImageView.isAccessibilityElement = trueThe image is created from data, so it has no name, and it has no accessibilityLabel.
Image(systemName: "...")
.accessibilityElement()
.accessibilityAddTraits(.isImage)Cross Platform
The image has no semanticLabel.
child: Semantics(
container: true,
child: Focus(
child: Image.asset(
'assets/logo.png',
width: 100,
height: 100,
),
),
),The image is accessible, but it has no accessibilityLabel.
<Image
source={require('...')}
style={{ width: ..., height: ... }}
accessible
/><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
- Turn on VoiceOver on iOS, or TalkBack on Android.
- Swipe right or left to move to the image.
- 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
- iOS: In Xcode, open Xcode > Open Developer Tool > Accessibility Inspector, select the simulator or device, and point at the image.
- 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:
- The
textattribute is present and not empty and the field does not haveimportantForAccessibilityset to false. - The
contentDescriptionis present and not empty and the field does not haveimportantForAccessibilityset tofalse. - A parent container meets the above 2 conditions if the element has
importantForAccessibilityset totrue.
- The
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 (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 | Same as the WCAG text. |
Personas impacted by this issue
Learn More
- Understanding Non-text Content (W3C)
- Images Tutorial (WAI)
- WAI website
- Writing Effective Text Alternatives for Images