Misaligned Assistive Description

Id MisalignedAssistiveDescription
Summary The assistive description misrepresents the element's content or function
Severity N/A
Category Assistive Technologies / Content Descriptions
Affects Resource files and Kotlin and Java files
Implementation AI, or other solutions could be considered to potentially find misaligned content descriptions, since the context of the content is crucial. In the other hand, differential analysis could be considered, as this bug is most likely a consecuence of changing an element's content or function and forgetting to change its content description

Symptom

The android:contentDescription attribute doesn't accurately reflect the visual element's appearance, function, or current state, or doesn't align with the app's established terminology.

Rationale

Inconsistent content descriptions create confusion for assistive technology users who expect descriptions to accurately represent elements and match interface terminology, leading to disorientation, task completion errors, and reduced confidence in navigation.

Examples

XML Layout Example

<!-- Content description doesn't match the actual icon -->
<ImageButton
    android:layout_width="48dp"
    android:layout_height="48dp"
    android:src="@drawable/ic_play"
    android:contentDescription="Pause music" />
    <!-- Inconsistent: icon shows play symbol but description says "Pause" -->
    <!-- Should be: android:contentDescription="Play" -->

Kotlin Code Example

class MediaPlayerActivity : AppCompatActivity() {

    private fun setupPlayButton() {
        val playButton = findViewById<ImageButton>(R.id.play_button)
        playButton.setImageResource(R.drawable.ic_play) // Shows play icon

        // Inconsistent: visual shows play icon but description says "Pause"
        playButton.contentDescription = "Pause music"

        // TalkBack user hears "Pause music" but icon shows play symbol
        // User expects to pause but will actually start playing

        // Correct approach: playButton.contentDescription = "Play"
    }
}

GitHub issues under this tag