Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TextInputEditText] [TextInputLayout] TalkBack issue when error is displayed #2256

Open
pmellaaho opened this issue Jun 17, 2021 · 0 comments

Comments

@pmellaaho
Copy link

Description: I have a TalkBack issue with TextInputLayout + TextInputEditText combo. I have a form type of screen that presents a number of editable fields (some mandatory, some optional) to the user. I’m performing a form validation when the user selects Save action.  If the form is not properly filled (e.g. mandatory info missing, field input is too short or otherwise does not fill the requirements) I set the error message on the TextInputLayout and make requestFocus() -call on the first text field that has an error. The TalkBack will then correctly read the error message but the accessibility focus (green box) stays in the element (ToolBar action) that fired the form validation.

To tackle this issue I started experimenting if I could move the accessibility focus on the text field by making this call:
inputEdit.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED)

If I make the call on the TextInputEditText, the behavior will change. Now the accessibility focus will move to the view that has focus and error set but the TalkBack reads the hint text set on the TextInputLayout. If I make the call on the TextInputLayout instead, it doesn’t do anything i.e. TalkBack will read the error message but the accessibility focus is not moved.

Expected behavior: There should an easy way (preferably default behavior) to move the accessibility focus and make the TalkBack to read an error message set on the TextInputLayout when the view gets the focus.

Source code:
`<com.google.android.material.textfield.TextInputLayout
android:id="@+id/productIdLayout"
style="@style/myInputFieldStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/product_id"
app:error="@{product.productIdError}"
app:errorEnabled="true">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/productIdEdit"                    
                android:layout_width="match_parent"
                android:layout_height="wrap_content"                    
                android:text="@={product.productId}" />
        </com.google.android.material.textfield.TextInputLayout>`

Android API version: Android API 28

Material Library version: 1.3.0

Device: Sony Xperia (G8441)

To help us triage faster, please check to make sure you are using the latest version of the library.

We also happily accept pull requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants