Redundant Control Type in Labels

Id RedundantControlTypeInLabels
Summary Labels redundantly include control types (e.g., “Button”), already identified by semantics
Severity Warning
Category Assistive Technologies / Content Descriptions
Affects Resource files and Kotlin and Java files
Implementation Custom lint rule - detect Redundant Control Type (button, image, text field, icon, etc.) in Labels
Tests Source Code

Symptom

contentDescription attribute includes the UI element type (e.g., "button", "image", "text field") that screen readers already announce automatically, creating redundant information.

Rationale

Creates verbose and repetitive announcements for assistive technology users who hear the element type twice, reducing efficiency and creating unnecessary cognitive load during navigation.

Examples

XML Layout Example

<ImageButton
    android:layout_width="48dp"
    android:layout_height="48dp"
    android:src="@drawable/ic_share"
    android:contentDescription="Share button" />
    <!-- TalkBack announces: "Share button, button" (redundant) -->
    <!-- Should be: android:contentDescription="Share" -->

Kotlin Code Example

class ShareActivity : AppCompatActivity() {

    private fun setupShareButton() {
        val shareButton = findViewById<ImageButton>(R.id.share_button)

        shareButton.contentDescription = "Share button"
        // TalkBack announces: "Share button, button" (redundant)

        // Correct approach: shareButton.contentDescription = "Share"
        // TalkBack would announce: "Share, button" (clear and concise)
    }
}

GitHub issues under this tag