Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 72e2c2a4cddeaf9a80e664fd6fb8a12b9d962c48
Author: Anastasia Soboleva <soboleva@google.com>
Date: Tue Mar 23 15:34:44 2021
Add error API to mark node that contains invalid input
In accessibility services there're two APIs - setContentInvalid(Boolean) and setError(CharSequence).
And yet setting the error text requires the former to be set to true. At the same time, just setting contentInvalid to true will not result in anything.
Therefore having two APIs is not very beneficial and may only cause confusion. As such, in this CL I introduce a single API that takes an error description.
Name was not a clear choice, but decided to go with `error()` (as oppose to invalid or invalidContent) because
* this is what TextView uses, so developers should be familiar
* our material text fields have a 'isError' parameter for styling purpose. Therefore, it will be easier for developers to find the semantics if it has a very close name to something that is already treated as error.
In material text field we supply error semantics with default message in case developers forget to provide this semantics.
Relnote: "Added accessibility API `error` that allows to mark a node that contains invalid input"
Fixes: 180584804
Fixes: 182142737
Test: new tests in AndroidComposeViewAccessibilityDelegateCompatTest
Test: manually with Talkback on and alternative locale
Change-Id: I129977e3d3b5f03435de41de409fde9029c325b9
M compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/MaterialTextField.kt
M compose/material/material/samples/src/main/java/androidx/compose/material/samples/TextFieldSamples.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/OutlinedTextFieldTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldTest.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Strings.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldImpl.kt
M compose/ui/ui/api/1.0.0-beta06.txt
M compose/ui/ui/api/current.txt
M compose/ui/ui/api/public_plus_experimental_1.0.0-beta06.txt
M compose/ui/ui/api/public_plus_experimental_current.txt
M compose/ui/ui/api/restricted_1.0.0-beta06.txt
M compose/ui/ui/api/restricted_current.txt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/AndroidAccessibilityTest.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/AndroidComposeViewAccessibilityDelegateCompatTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeViewAccessibilityDelegateCompat.android.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsProperties.kt
https://android-review.googlesource.com/1651127
Branch: androidx-main
commit 72e2c2a4cddeaf9a80e664fd6fb8a12b9d962c48
Author: Anastasia Soboleva <soboleva@google.com>
Date: Tue Mar 23 15:34:44 2021
Add error API to mark node that contains invalid input
In accessibility services there're two APIs - setContentInvalid(Boolean) and setError(CharSequence).
And yet setting the error text requires the former to be set to true. At the same time, just setting contentInvalid to true will not result in anything.
Therefore having two APIs is not very beneficial and may only cause confusion. As such, in this CL I introduce a single API that takes an error description.
Name was not a clear choice, but decided to go with `error()` (as oppose to invalid or invalidContent) because
* this is what TextView uses, so developers should be familiar
* our material text fields have a 'isError' parameter for styling purpose. Therefore, it will be easier for developers to find the semantics if it has a very close name to something that is already treated as error.
In material text field we supply error semantics with default message in case developers forget to provide this semantics.
Relnote: "Added accessibility API `error` that allows to mark a node that contains invalid input"
Fixes: 180584804
Fixes: 182142737
Test: new tests in AndroidComposeViewAccessibilityDelegateCompatTest
Test: manually with Talkback on and alternative locale
Change-Id: I129977e3d3b5f03435de41de409fde9029c325b9
M compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/MaterialTextField.kt
M compose/material/material/samples/src/main/java/androidx/compose/material/samples/TextFieldSamples.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/OutlinedTextFieldTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldTest.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Strings.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldImpl.kt
M compose/ui/ui/api/1.0.0-beta06.txt
M compose/ui/ui/api/current.txt
M compose/ui/ui/api/public_plus_experimental_1.0.0-beta06.txt
M compose/ui/ui/api/public_plus_experimental_current.txt
M compose/ui/ui/api/restricted_1.0.0-beta06.txt
M compose/ui/ui/api/restricted_current.txt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/AndroidAccessibilityTest.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/AndroidComposeViewAccessibilityDelegateCompatTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeViewAccessibilityDelegateCompat.android.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsProperties.kt
Description
Accessibility Services have two APIs to communicate an invalid/erroneous state.
error
used for TextFieldcontentInvalid
used for invalid dates?This needs more investigation to see what API we want to expose in Compose.