-
Notifications
You must be signed in to change notification settings - Fork 29.2k
Use live region in error text input decorator for Android #165531
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
Use live region in error text input decorator for Android #165531
Conversation
The original issue #99715 is not on android but on macOS with voiceover, can you test if the live region works there? |
Looks like macos has issues with liveregion and not speaking this text. Does macos not support liveregion at all? |
e58f957
to
675d730
Compare
804b5d4
to
248d5ab
Compare
I added back the original code for the other platforms and turned on liveRegion and removed the deprecated announce call for Android. |
7da36ca
to
509583c
Compare
@@ -369,7 +369,7 @@ class FormState extends State<Form> { | |||
} | |||
} | |||
|
|||
if (errorMessage.isNotEmpty) { | |||
if (errorMessage.isNotEmpty && defaultTargetPlatform != TargetPlatform.android) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment here that android is use live region for error message and others are using announcement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you instead refactor this into a method named "shouldPreferLiveRegionOverAnnounce"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up choosing to go with isAnnounceSupported
because live region would probably not be the best replacement all the time. The PR for that is in #166099
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reidbaker this PR can be reviewed now since the parent PR was merged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a nit comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also update the pr description with the current state of the pr. (forked behavior instead of a pure revert)
@ash2moon see https://docs.flutter.dev/ui/adaptive-responsive/capabilities for a longer set of documenation on my thoughts behind why we should abstract the logic around platform checking to a method.
@@ -369,7 +369,7 @@ class FormState extends State<Form> { | |||
} | |||
} | |||
|
|||
if (errorMessage.isNotEmpty) { | |||
if (errorMessage.isNotEmpty && defaultTargetPlatform != TargetPlatform.android) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you instead refactor this into a method named "shouldPreferLiveRegionOverAnnounce"
Made this PR to resolve this issue: I'll update the code in this PR once that one is merged. |
509583c
to
d2d38d9
Compare
5347271
to
20db932
Compare
<!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> Helps unblock #165531 and is part of #165510 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
flutter/flutter@336a7ec...0b9f928 2025-05-14 robert.ancell@canonical.com Fix Linux Impeller support broken by incorrect deletion of stencil buffer. (flutter/flutter#168668) 2025-05-14 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 6J81agNhuK4q255Jj... to fSvuEJgRmHxnewRJr... (flutter/flutter#168794) 2025-05-14 matanlurey@users.noreply.github.com Run `{Platform} flutter_packaging` builders on release candidates. (flutter/flutter#168762) 2025-05-14 matanlurey@users.noreply.github.com Remove `docs_deploy_beta`, fix `docs_publish`, add comments. (flutter/flutter#168754) 2025-05-14 32538273+ValentinVignal@users.noreply.github.com Add `titleAlignment` to `CheckboxListTile` and `RadioListTile` (flutter/flutter#168666) 2025-05-14 32538273+ValentinVignal@users.noreply.github.com Remove deprecated todo about caching (flutter/flutter#168534) 2025-05-13 mohellebiabdessalem@gmail.com Replace hardcoded host and app level build.gradle paths with `AndroidProject`-level getters in `gradle_errors.dart` (flutter/flutter#167949) 2025-05-13 75997342+dogaozyagci@users.noreply.github.com Improve documentation for KeyedSubtree constructor (flutter/flutter#167198) 2025-05-13 31859944+LongCatIsLooong@users.noreply.github.com Wire up the system text scaler from `PlatformDispatcher` (flutter/flutter#159999) 2025-05-13 engine-flutter-autoroll@skia.org Roll Dart SDK from 645d04a7a964 to b3520981e0f0 (3 revisions) (flutter/flutter#168721) 2025-05-13 jhy03261997@gmail.com [a11y] Semanctis flag refactor step 3: framework part (flutter/flutter#167771) 2025-05-13 matanlurey@users.noreply.github.com Remove/replace the `team` label with `c: contributor-productivity`. (flutter/flutter#168702) 2025-05-13 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Clip search artifacts in CupertinoSliverNavigationBar searchable-to-searchable transitions (#168510)" (flutter/flutter#168775) 2025-05-13 muhatashim@google.com Use live region in error text input decorator for Android (flutter/flutter#165531) 2025-05-13 kevmoo@users.noreply.github.com [tool] Fix deprecated API calls within tool (flutter/flutter#168200) 2025-05-13 victorsanniay@gmail.com Clip search artifacts in CupertinoSliverNavigationBar searchable-to-searchable transitions (flutter/flutter#168510) 2025-05-13 47866232+chunhtai@users.noreply.github.com Fixes hero not shown when remove pages without animation (flutter/flutter#168617) 2025-05-13 rmolivares@renzo-olivares.dev [iOS] Do not hide selection handles when platform hides system context menu (flutter/flutter#168678) 2025-05-13 jessy.yameogo@gmail.com Updated execution path to silently include --start-paused and updated tests (flutter/flutter#168400) 2025-05-13 engine-flutter-autoroll@skia.org Roll Packages from 6a28ad9 to 2e166de (2 revisions) (flutter/flutter#168736) 2025-05-13 sokolovskyi.konstantin@gmail.com [web] Fix multiline input selection in Chrome. (flutter/flutter#168217) 2025-05-13 15619084+vashworth@users.noreply.github.com Call xcode_backend.dart from macos_assemble.sh (flutter/flutter#168108) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
reason for revert: Breaks google client tests |
…165531)" (#168848) <!-- start_original_pr_link --> Reverts: #165531 <!-- end_original_pr_link --> <!-- start_initiating_author --> Initiated by: matanlurey <!-- end_initiating_author --> <!-- start_revert_reason --> Reason for reverting: Breaks google client tests <!-- end_revert_reason --> <!-- start_original_pr_author --> Original PR Author: ash2moon <!-- end_original_pr_author --> <!-- start_reviewers --> Reviewed By: {chunhtai, reidbaker, hannah-hyj} <!-- end_reviewers --> <!-- start_revert_body --> This change reverts the following previous change: Resolves partly #165510 **Context:** This issue originates from #99715, where it was reported that `liveRegion` alone was insufficient for announcing form validation errors. While `liveRegion` announces the first error encountered, subsequent submissions with the same error message on Android would not trigger a re-announcement. **Original Solution:** Pull request #123373 addressed this by implementing the `announce` event to ensure error messages were consistently announced, even for repeated submissions. **Native Android Behavior (Jetpack Compose):** In native Android development using Jetpack Compose, setting the `isError` property of a `TextField` to `true` triggers Talkback to announce "Error invalid input." This announcement occurs *only* on the initial change to the error state. Subsequent errors, even if the `isError` property remains `true`, are not re-announced. This behavior closely mirrors the functionality of `liveRegion`, with the key difference being that `liveRegion` also announces the specific error text, in addition to the general error state. Testing in a native Jetpack Compose application confirms this behavior and provides a valuable comparison point against the current Flutter form example. **Suggested Action:** **Fork** the behavior in #123373. Reinstate the use of `liveRegion` for error announcements within `widgets/Form` for Android and keep other platforms the same. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md <!-- end_revert_body --> Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
Partly of #165510⤵️ Child PR: #168992 Partly re-lands #165531 The PR was originally reverted due to an issue with an internal Google test. I split re-land PR into two separate ones so that we can individually revert in case it fails again. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
…r#9251) flutter/flutter@336a7ec...0b9f928 2025-05-14 robert.ancell@canonical.com Fix Linux Impeller support broken by incorrect deletion of stencil buffer. (flutter/flutter#168668) 2025-05-14 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 6J81agNhuK4q255Jj... to fSvuEJgRmHxnewRJr... (flutter/flutter#168794) 2025-05-14 matanlurey@users.noreply.github.com Run `{Platform} flutter_packaging` builders on release candidates. (flutter/flutter#168762) 2025-05-14 matanlurey@users.noreply.github.com Remove `docs_deploy_beta`, fix `docs_publish`, add comments. (flutter/flutter#168754) 2025-05-14 32538273+ValentinVignal@users.noreply.github.com Add `titleAlignment` to `CheckboxListTile` and `RadioListTile` (flutter/flutter#168666) 2025-05-14 32538273+ValentinVignal@users.noreply.github.com Remove deprecated todo about caching (flutter/flutter#168534) 2025-05-13 mohellebiabdessalem@gmail.com Replace hardcoded host and app level build.gradle paths with `AndroidProject`-level getters in `gradle_errors.dart` (flutter/flutter#167949) 2025-05-13 75997342+dogaozyagci@users.noreply.github.com Improve documentation for KeyedSubtree constructor (flutter/flutter#167198) 2025-05-13 31859944+LongCatIsLooong@users.noreply.github.com Wire up the system text scaler from `PlatformDispatcher` (flutter/flutter#159999) 2025-05-13 engine-flutter-autoroll@skia.org Roll Dart SDK from 645d04a7a964 to b3520981e0f0 (3 revisions) (flutter/flutter#168721) 2025-05-13 jhy03261997@gmail.com [a11y] Semanctis flag refactor step 3: framework part (flutter/flutter#167771) 2025-05-13 matanlurey@users.noreply.github.com Remove/replace the `team` label with `c: contributor-productivity`. (flutter/flutter#168702) 2025-05-13 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Clip search artifacts in CupertinoSliverNavigationBar searchable-to-searchable transitions (#168510)" (flutter/flutter#168775) 2025-05-13 muhatashim@google.com Use live region in error text input decorator for Android (flutter/flutter#165531) 2025-05-13 kevmoo@users.noreply.github.com [tool] Fix deprecated API calls within tool (flutter/flutter#168200) 2025-05-13 victorsanniay@gmail.com Clip search artifacts in CupertinoSliverNavigationBar searchable-to-searchable transitions (flutter/flutter#168510) 2025-05-13 47866232+chunhtai@users.noreply.github.com Fixes hero not shown when remove pages without animation (flutter/flutter#168617) 2025-05-13 rmolivares@renzo-olivares.dev [iOS] Do not hide selection handles when platform hides system context menu (flutter/flutter#168678) 2025-05-13 jessy.yameogo@gmail.com Updated execution path to silently include --start-paused and updated tests (flutter/flutter#168400) 2025-05-13 engine-flutter-autoroll@skia.org Roll Packages from 6a28ad9 to 2e166de (2 revisions) (flutter/flutter#168736) 2025-05-13 sokolovskyi.konstantin@gmail.com [web] Fix multiline input selection in Chrome. (flutter/flutter#168217) 2025-05-13 15619084+vashworth@users.noreply.github.com Call xcode_backend.dart from macos_assemble.sh (flutter/flutter#168108) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…r#9251) flutter/flutter@336a7ec...0b9f928 2025-05-14 robert.ancell@canonical.com Fix Linux Impeller support broken by incorrect deletion of stencil buffer. (flutter/flutter#168668) 2025-05-14 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 6J81agNhuK4q255Jj... to fSvuEJgRmHxnewRJr... (flutter/flutter#168794) 2025-05-14 matanlurey@users.noreply.github.com Run `{Platform} flutter_packaging` builders on release candidates. (flutter/flutter#168762) 2025-05-14 matanlurey@users.noreply.github.com Remove `docs_deploy_beta`, fix `docs_publish`, add comments. (flutter/flutter#168754) 2025-05-14 32538273+ValentinVignal@users.noreply.github.com Add `titleAlignment` to `CheckboxListTile` and `RadioListTile` (flutter/flutter#168666) 2025-05-14 32538273+ValentinVignal@users.noreply.github.com Remove deprecated todo about caching (flutter/flutter#168534) 2025-05-13 mohellebiabdessalem@gmail.com Replace hardcoded host and app level build.gradle paths with `AndroidProject`-level getters in `gradle_errors.dart` (flutter/flutter#167949) 2025-05-13 75997342+dogaozyagci@users.noreply.github.com Improve documentation for KeyedSubtree constructor (flutter/flutter#167198) 2025-05-13 31859944+LongCatIsLooong@users.noreply.github.com Wire up the system text scaler from `PlatformDispatcher` (flutter/flutter#159999) 2025-05-13 engine-flutter-autoroll@skia.org Roll Dart SDK from 645d04a7a964 to b3520981e0f0 (3 revisions) (flutter/flutter#168721) 2025-05-13 jhy03261997@gmail.com [a11y] Semanctis flag refactor step 3: framework part (flutter/flutter#167771) 2025-05-13 matanlurey@users.noreply.github.com Remove/replace the `team` label with `c: contributor-productivity`. (flutter/flutter#168702) 2025-05-13 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Clip search artifacts in CupertinoSliverNavigationBar searchable-to-searchable transitions (#168510)" (flutter/flutter#168775) 2025-05-13 muhatashim@google.com Use live region in error text input decorator for Android (flutter/flutter#165531) 2025-05-13 kevmoo@users.noreply.github.com [tool] Fix deprecated API calls within tool (flutter/flutter#168200) 2025-05-13 victorsanniay@gmail.com Clip search artifacts in CupertinoSliverNavigationBar searchable-to-searchable transitions (flutter/flutter#168510) 2025-05-13 47866232+chunhtai@users.noreply.github.com Fixes hero not shown when remove pages without animation (flutter/flutter#168617) 2025-05-13 rmolivares@renzo-olivares.dev [iOS] Do not hide selection handles when platform hides system context menu (flutter/flutter#168678) 2025-05-13 jessy.yameogo@gmail.com Updated execution path to silently include --start-paused and updated tests (flutter/flutter#168400) 2025-05-13 engine-flutter-autoroll@skia.org Roll Packages from 6a28ad9 to 2e166de (2 revisions) (flutter/flutter#168736) 2025-05-13 sokolovskyi.konstantin@gmail.com [web] Fix multiline input selection in Chrome. (flutter/flutter#168217) 2025-05-13 15619084+vashworth@users.noreply.github.com Call xcode_backend.dart from macos_assemble.sh (flutter/flutter#168108) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…165531" (#168992) Partly of #165510⤴️ Parent PR: #169685 (✅ Merged)⤴️ Parent PR (refactor): #170618 (✅ Merged) Re-lands #165531 The PR was originally reverted due to an issue with an internal Google test. I added a new test case under `input_decorator_test.dart` which does something similar to prevent the regression. All other code is the same as #165531. The easiest way to review this would probably be to just check the [diff after the first commit](cb5647c) to see the changes I made. To check if the reland commit is the same, it might be best to just [compare solely that commit](9bd8d56) against the [original PR](https://github.com/flutter/flutter/pull/165531/files). ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
…lutter#165531" (flutter#168992) Partly of flutter#165510⤴️ Parent PR: flutter#169685 (✅ Merged)⤴️ Parent PR (refactor): flutter#170618 (✅ Merged) Re-lands flutter#165531 The PR was originally reverted due to an issue with an internal Google test. I added a new test case under `input_decorator_test.dart` which does something similar to prevent the regression. All other code is the same as flutter#165531. The easiest way to review this would probably be to just check the [diff after the first commit](flutter@cb5647c) to see the changes I made. To check if the reland commit is the same, it might be best to just [compare solely that commit](flutter@9bd8d56) against the [original PR](https://github.com/flutter/flutter/pull/165531/files). ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
<!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> Helps unblock flutter#165531 and is part of flutter#165510 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Resolves partly #165510
Context: This issue originates from #99715, where it was reported that
liveRegion
alone was insufficient for announcing form validation errors. WhileliveRegion
announces the first error encountered, subsequent submissions with the same error message on Android would not trigger a re-announcement.Original Solution: Pull request #123373 addressed this by implementing the
announce
event to ensure error messages were consistently announced, even for repeated submissions.Native Android Behavior (Jetpack Compose): In native Android development using Jetpack Compose, setting the
isError
property of aTextField
totrue
triggers Talkback to announce "Error invalid input." This announcement occurs only on the initial change to the error state. Subsequent errors, even if theisError
property remainstrue
, are not re-announced. This behavior closely mirrors the functionality ofliveRegion
, with the key difference being thatliveRegion
also announces the specific error text, in addition to the general error state. Testing in a native Jetpack Compose application confirms this behavior and provides a valuable comparison point against the current Flutter form example.Suggested Action: Fork the behavior in #123373. Reinstate the use of
liveRegion
for error announcements withinwidgets/Form
for Android and keep other platforms the same.Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.