Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 678
oziomajnr Avatar asked May 21 '19 07:05

oziomajnr


People also ask

What is content description of image in Android Studio?

The content description attribute links a text description to a control, ImageView, or other focusable object that otherwise has no text content. These objects wouldn't be accessible without some some sort of label or description.

What is the use of content description in Android?

When using an ImageView , ImageButton , CheckBox , or other View that conveys information graphically, use an android:contentDescription attribute to provide a content label for that View . A content label sometimes depends on information only available at runtime, or the meaning of a View might change over time.

Which of the following attributes should you add to ImageView and ImageButton elements to enable screen readers to describe the image Mcq?

Non-textual widgets like ImageViews and ImageButtons should use the contentDescription attribute to specify a textual description of the widget such that screen readers and other accessibility tools can adequately describe the user interface.


1 Answers

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.

like image 141
Diego Malone Avatar answered Dec 12 '22 14:12

Diego Malone