material-components / material-components/material-components-android
[TextInputEditText] [TextInputLayout] TalkBack issue when error is displayed
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Java
- Estrellas
- 17.4k
- Forks
- 3.2k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza reproduciendo el comportamiento de TalkBack a partir del XML proporcionado de TextInputLayout y TextInputEditText en Android API 28, centrándote en los anuncios de foco y de errores. Rastrea el comportamiento de accesibilidad de TextInputLayout y TextInputEditText; se considera terminado cuando el foco de accesibilidad se mueve al campo con error y TalkBack lee el error de TextInputLayout cuando se solicita el foco.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- android
- Área
- accessibility, mobile
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 38/100