-
Notifications
You must be signed in to change notification settings - Fork 29.8k
[a11y] Add expanded flag support to Android.
#174981
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
[a11y] Add expanded flag support to Android.
#174981
Conversation
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.
Code Review
This pull request adds support for the expanded semantics flag on Android, along with onExpand and onCollapse semantics actions. The changes are extensive, touching the Dart framework, the engine (Dart, C++, Java), and tests. The update to the robolectric library is also included and justified. The implementation is well-executed and includes appropriate tests. I have identified a couple of areas where the robustness of the new action handlers can be improved.
chunhtai
left a 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.
LGTM
engine/src/flutter/shell/platform/android/test/io/flutter/view/AccessibilityBridgeTest.java
Show resolved
Hide resolved
engine/src/flutter/shell/platform/android/test/io/flutter/view/AccessibilityBridgeTest.java
Show resolved
Hide resolved
engine/src/flutter/shell/platform/android/test/io/flutter/view/AccessibilityBridgeTest.java
Outdated
Show resolved
Hide resolved
|
@ash2moon, could you please help here, as I'm unsure how to resolve this issue on CI/CD? |
robert-ancell
left a 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.
Reviewing how this will work on Linux.
The a11y framework on Linux (AT-SPI) supports named actions, so this should be translatable there. The nearest widget I could find that was similar (GtkExpander) uses the button role and thus I didn't find any existing cases where this action was used. GTK4 uses AccessKit (Flutter is using GTK3 which uses ATK), which does support the expand/collapse actions. So this should be implementable in Linux.
|
From android triage: Thanks for the contribution, we will get the java updated to unblock this PR |
Roll Flutter from 6cc976e to 96fe3b3 (32 revisions) flutter/flutter@6cc976e...96fe3b3 2025-09-29 engine-flutter-autoroll@skia.org Roll Packages from 389c678 to 34eec78 (6 revisions) (flutter/flutter#176205) 2025-09-29 engine-flutter-autoroll@skia.org Roll Skia from 9b2b942d1eb1 to bb3b6bd4be0d (4 revisions) (flutter/flutter#176201) 2025-09-29 bkonyi@google.com [ Widget Preview ] Improve IDE integration support (flutter/flutter#176114) 2025-09-29 robert.ancell@canonical.com Fix name of driver file (flutter/flutter#176186) 2025-09-29 engine-flutter-autoroll@skia.org Roll Skia from beb673968802 to 9b2b942d1eb1 (3 revisions) (flutter/flutter#176190) 2025-09-28 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 0Z45OXT_Wb8aWI3a0... to 8zjcJic_DtvB2Bo2x... (flutter/flutter#176158) 2025-09-28 flar@google.com Revert "[Impeller] Optimize scale translate rectangle transforms" (flutter/flutter#176161) 2025-09-27 engine-flutter-autoroll@skia.org Roll Skia from 2e5da5c0a9cd to beb673968802 (1 revision) (flutter/flutter#176145) 2025-09-27 flar@google.com [Impeller] Optimize scale translate rectangle transforms (flutter/flutter#176123) 2025-09-27 engine-flutter-autoroll@skia.org Roll Skia from d8422aaf8f89 to 2e5da5c0a9cd (2 revisions) (flutter/flutter#176141) 2025-09-27 mdebbar@google.com [web] Remove mention of non-existent `canvaskit_lock.yaml` (flutter/flutter#176108) 2025-09-27 engine-flutter-autoroll@skia.org Roll Skia from 96b73f61fe61 to d8422aaf8f89 (2 revisions) (flutter/flutter#176118) 2025-09-27 sokolovskyi.konstantin@gmail.com [a11y] Add `expanded` flag support to Android. (flutter/flutter#174981) 2025-09-26 ahmedsameha1@gmail.com Make sure that a DesktopTextSelectionToolbar doesn't crash in 0x0 env… (flutter/flutter#173928) 2025-09-26 engine-flutter-autoroll@skia.org Roll Dart SDK from 899c7340cc4c to af31d2637b6b (11 revisions) (flutter/flutter#176056) 2025-09-26 1063596+reidbaker@users.noreply.github.com Update java version ranges with the top end limitation for java pre 17 (flutter/flutter#176049) 2025-09-26 1063596+reidbaker@users.noreply.github.com Add warn java evaluation to android_workflow (flutter/flutter#176097) 2025-09-26 katelovett@google.com Removes type annotations in templates (flutter/flutter#176106) 2025-09-26 fluttergithubbot@gmail.com Marks Linux_pixel_7pro static_path_stroke_tessellation_perf__timeline_summary to be unflaky (flutter/flutter#175917) 2025-09-26 1063596+reidbaker@users.noreply.github.com Add kotlin/kgp 2.2.* evaluation criteria. (flutter/flutter#176094) 2025-09-26 32538273+ValentinVignal@users.noreply.github.com Migrate to `WidgetStateMouseCursor` (flutter/flutter#175981) 2025-09-26 engine-flutter-autoroll@skia.org Roll Packages from 117bf63 to 389c678 (4 revisions) (flutter/flutter#176092) 2025-09-26 34871572+gmackall@users.noreply.github.com Fix link to .gclient setup instructions (flutter/flutter#176046) 2025-09-26 matt.kosarek@canonical.com Implement Regular Windows for the win32 framework + add an example application for regular windows (flutter/flutter#173715) 2025-09-26 engine-flutter-autoroll@skia.org Roll Skia from 5d99c3fc7c83 to 96b73f61fe61 (3 revisions) (flutter/flutter#176075) 2025-09-26 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from naeytagBIBEpKgZNZ... to 0Z45OXT_Wb8aWI3a0... (flutter/flutter#176068) 2025-09-26 100504385+AlsoShantanuBorkar@users.noreply.github.com Add itemClipBehavior property for CarouselView's children (flutter/flutter#175324) 2025-09-26 engine-flutter-autoroll@skia.org Roll Skia from 55436d87e414 to 5d99c3fc7c83 (4 revisions) (flutter/flutter#176060) 2025-09-26 flar@google.com Revert "[Impeller] Optimize scale translate rectangle transforms" (flutter/flutter#176061) 2025-09-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Reapply "Update the AccessibilityPlugin::Announce method to account f… (#174365)" (flutter/flutter#176059) 2025-09-25 ahmedsameha1@gmail.com Make sure that a CupertinoDesktopTextSelectionToolbarButton doesn't c… (flutter/flutter#173894) 2025-09-25 mohellebiabdessalem@gmail.com Improve code quality in `SensitiveContentPluginTest.java` (flutter/flutter#175721) 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 ...
Bumps robolectric to support Android API 36 and JDK to 21 One of the tests is failing due to a change in how JDK 19 handles unicode characters in word breaks. The test was skipped and a new issue was created below. flutter#175623 Resolves flutter#175454 Unblocks flutter#174981 - [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]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- 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
Bumps robolectric to support Android API 36 and JDK to 21 One of the tests is failing due to a change in how JDK 19 handles unicode characters in word breaks. The test was skipped and a new issue was created below. flutter#175623 Resolves flutter#175454 Unblocks flutter#174981 - [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]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- 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
Closes flutter#92040 - Adds `expanded` semantics flag support to Android - Adds `onExpand` and `onCollapse` semantics actions - Updates `robolectric` library - Adds java and dart tests #### Why were `onExpand` and `onCollapse` actions added? It turned out that TalkBack doesn't announce the `expanded` state if `expand/collapse` action is not set for the accessibility node. #### Why was the `robolectric` library updated? The `expanded` state support in Android was introduced in API 36. The `roboelectric: 4.14.1` doesn't support API 36. To run tests for a newly added functionality `roboelectric` library was updated to `4.16`, which supports the latest Android version (https://github.com/robolectric/robolectric/releases/tag/robolectric-4.16). In case you think it would be better to update the `roboelectric` in a separate PR, please let me know. <br/> <details> <summary>Example Source Code</summary> ```dart import 'package:flutter/material.dart'; void main() { runApp(const App()); } class App extends StatefulWidget { const App({super.key}); @OverRide State<App> createState() => _AppState(); } class _AppState extends State<App> { final _controller = ExpansibleController(); @OverRide void dispose() { _controller.dispose(); super.dispose(); } @OverRide Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: Scaffold( body: Column( mainAxisAlignment: MainAxisAlignment.center, spacing: 24, children: [ Text('Expansible Example'), ListenableBuilder( listenable: _controller, builder: (context, child) { return Semantics( expanded: _controller.isExpanded, onExpand: () { print(' \n onExpand \n '); _controller.expand(); }, onCollapse: () { print(' \n onCollapse \n '); _controller.collapse(); }, child: child, ); }, child: Expansible( headerBuilder: (context, _) => ListTile( tileColor: Colors.blue.shade100, leading: Text( 'Expansible', style: TextStyle(fontSize: 20), ), trailing: Icon( _controller.isExpanded ? Icons.arrow_upward : Icons.arrow_downward, semanticLabel: _controller.isExpanded ? 'Arrow Up icon' : 'Arrow Down icon', ), ), bodyBuilder: (context, _) { return Container( color: Colors.blue, height: 200, width: 200, ); }, controller: _controller, ), ), ], ), ), ); } } ``` </details> https://github.com/user-attachments/assets/256c4182-a1e3-44fc-b028-5e6c9ec05ad7 ## 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 --------- Co-authored-by: ash2moon <muhatashim@google.com>
Closes #92040
expandedsemantics flag support to AndroidonExpandandonCollapsesemantics actionsrobolectriclibraryWhy were
onExpandandonCollapseactions added?It turned out that TalkBack doesn't announce the
expandedstate ifexpand/collapseaction is not set for the accessibility node.Why was the
robolectriclibrary updated?The
expandedstate support in Android was introduced in API 36. Theroboelectric: 4.14.1doesn't support API 36. To run tests for a newly added functionalityroboelectriclibrary was updated to4.16, which supports the latest Android version (https://github.com/robolectric/robolectric/releases/tag/robolectric-4.16).In case you think it would be better to update the
roboelectricin a separate PR, please let me know.Example Source Code
expasible_example.mov
Pre-launch Checklist
///).