mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
<!-- start_original_pr_link --> Reverts: flutter/flutter#174374 <!-- end_original_pr_link --> <!-- start_initiating_author --> Initiated by: chingjun <!-- end_initiating_author --> <!-- start_revert_reason --> Reason for reverting: This PR calls the constructor of `AccessibilityNodeInfo.CollectionInfo`, which is added in API 30, without the API version guard. It broke some internal tests that are running on API 29 and below. <!-- end_revert_reason --> <!-- start_original_pr_author --> Original PR Author: jwlilly <!-- end_original_pr_author --> <!-- start_reviewers --> Reviewed By: {camsim99, ash2moon} <!-- end_reviewers --> <!-- start_revert_body --> This change reverts the following previous change: Updating AccessibilityBridge.java and AccessibilityBridgeTest.java to include `AccessibilityNodeInfo.CollectionItemInfo` to get TalkBack to announce item indexes for ListViews. - Updated the logic for adding CollectionInfo to add when the scrollChildren count is greater than 1. This is an attempt to exclude something like a SingleChildScrollView from getting CollectionInfo added. The only semantics info we can rely on from Android is the hasImplicitScrolling and the number of scrollChildren. - Added logic for adding the CollectionItemInfo to ListView children. It first checks to see if the parent node qualifies for CollectionInfo and then adds the CollectionItemInfo to the child view. The index values come from the `childrenInTraversalOrder`. We aren't currently passing the indexedSemantics into the SemanticsNode. Once those values are available, this can be made more robust. The following video includes the new changes with a ListView https://github.com/user-attachments/assets/b9bf1b80-9f29-40e2-8f33-a08919554b7e This video includes the logic with a SingleChildScrollView (no list announcements as expected) https://github.com/user-attachments/assets/8fe4dd24-cc5a-4a6b-b4b0-0f371fea20df Fixes #168651 - This is a minimal fix. A full fix would be to pass the indexedSemantics to the SemanticsNode in Android and build the list with those values. ## 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. <!-- 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>