moxi
moxi

Reputation: 1452

TextInputLayout inside of a scroll view label not announced

I have a not so complex layout, that is using a component, inside of a scroll view that has a nested LinearLayout, the problem is that Talkback doesn't announces the label.

 <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin">


    <LinearLayout
        android:id="@+id/content_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginLeft="@dimen/margin2x"
        android:layout_marginRight="@dimen/margin2x"
        android:animateLayoutChanges="true"
        android:contentDescription="Some Form Description"
        android:orientation="vertical">

        <TextView
            android:id="@+id/some_field"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="@dimen/margin"
            android:focusable="true"
            android:text="some field text" />

        <android.support.design.widget.TextInputLayout
            android:id="@+id/some_field_in_form_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <android.support.design.widget.TextInputEditText
                android:id="@+id/editText1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_alignParentStart="true"
                android:hint="Label for field" />

        </android.support.design.widget.TextInputLayout>

    </LinearLayout>

</ScrollView>

Talkback navigation skips the label, if the field has a value the user is not going to know what's the purpose of that field.

Upvotes: 0

Views: 1071

Answers (1)

moxi
moxi

Reputation: 1452

After some investigation I found the issue is because the LinearLayout has a content Description, is going to capture all the events. In my case I need to announce it, in order to fix my issue I had to explicitly set the children to be focusable.

   <android.support.design.widget.TextInputLayout
        android:id="@+id/some_field_in_form_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:focusable="true">

If the LinearLayout is the only parent this doesn't happen.

Upvotes: 1

Related Questions