oziomajnr
oziomajnr

Reputation: 1751

Why was the warning to add content description to image views and image button removed in AppCompat

When building layouts in android, if you use an ImageView or an ImageButton without adding a content description, then you would get a warning telling you to add a content description to the views with AppCompatImageView and AppCompatImageButton that warning is no longer available. I thought this is because the implementation for AppCompatImageView has a default content description based on the content of the view but talk back still reads it as an "un labelled button", why was the warning removed?

Upvotes: 12

Views: 509

Answers (1)

Diego Malone
Diego Malone

Reputation: 1052

This lint rule is designed to work on specific widget types. Currently, this rule is checking only ImageView and ImageButton widgets. The lack of warning for AppCompat widgets is because they have never added them to the element list.

The source code of the current implementation shows that it is applied only to ImageView and ImageButton.

public Collection<String> getApplicableElements() {
    return Arrays.asList(
            IMAGE_BUTTON,
            IMAGE_VIEW
    );
}

I have filled a bug on the Android issue tracker to request them to add AppCompatImageView and AppCompatImageButton to this lint rule. You may star the issue to convey your support.

Upvotes: 11

Related Questions