0

I have a linear layout containing a purely decorative ImageView, and a text view. as such I've labelled the image as importantForAccessibility="no" However, when highlighting the linear layout, Automatic Descriptions is still trying to read out the image, e.g. "Detected: image, [vague description]"

I know that automatic descriptions can be disabled by the user on some devices, but for example Samsung devices don't seem to be able to disable this.

Even so, labelling a view as not important for accessibility should mean that it's ignored by a screen reader. It's not the same as if the view was accidentally unlabelled, when we're specifically asking it to ignore this view.

I'm trying to give a clear and helpful screenreader UX but I can't see a way to prevent these unhelpful descriptions (surely importantForAccessibility=no should be enough?!

trying to get talkback to ignore decorative images, but automatic descriptions is overriding this. Tried labelling as focusable=false, which made no difference

example code (with unneeded detail taken out):

    <LinearLayout
        android:id="@+id/savingsLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:importantForAccessibility="yes"
        android:orientation="vertical">

        <ImageView
            android:id="@+id/savingsIcon"
            android:layout_width="..."
            android:layout_height="..."
            android:importantForAccessibility="no"
            android:src="@drawable/ic_logo" />

        <TextView
            android:id="@+id/savingsAmount"
            android:layout_width="..."
            android:layout_height="..."
            android:importantForAccessibility="no"
            tools:text="You saved £7.15 this time" />

    </LinearLayout>

I want Talkback to read the whole linear layout with just the value of the text view, because then a screenreader user has a larger touch target size if exploring by touch. However, i'm getting "You saved £7.15 this time detected image icon the logo of the website" or some other useless info... help!

3
  • Maybe it's because you added android:importantForAccessibility="yes" to the parent LinearLayout and then "no" to both children, even the TextView? Try to only add "no" to the image, and remove the accessibility info from the text and the layout, by default they are already important. Commented Mar 14, 2024 at 12:24
  • that's done for grouping purposes, so that the text information is read on the layout rather than on the individual text view. developer.android.com/guide/topics/ui/accessibility/… Commented Mar 14, 2024 at 16:47
  • From your link, for grouping you have to use android:screenReaderFocusable="true" and not android:importantForAccessibility="yes" Commented Mar 15, 2024 at 12:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.