-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Wire up MenuAnchor, MenuBar, MenuItem-related widgets to aria roles
#165596
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
Wire up MenuAnchor, MenuBar, MenuItem-related widgets to aria roles
#165596
Conversation
|
Once #164439 land, tests will be fixed. |
9b73d1f to
74d845f
Compare
Flutter PR flutter/flutter#165596 (wiring up MenuAnchor-related widgets to SemanticsRole) breaks this test; fix it by adding the needed Semantics wrappers. Co-authored-by: Chris Bobbe <[email protected]>
|
Created zulip/zulip-flutter#1443 to fix customer testing. |
Flutter PR flutter/flutter#165596 (wiring up MenuAnchor-related widgets to SemanticsRole) breaks this test; fix it by adding the needed Semantics wrappers. Co-authored-by: Chris Bobbe <[email protected]>
e2a509e to
f8a9f49
Compare
This is to fix the customer testing in flutter/flutter#165596 by picking up zulip/zulip-flutter#1443 ## 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 the [Flutter Style Guide] _recently_, and have followed its advice. - [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] All existing and new tests are passing.
f8a9f49 to
ae30e5b
Compare
| @@ -1 +1 @@ | |||
| 3566ea0e688123cecc2b605bda13732adc1e610a | |||
| 8be72094d9b33dae8ff8a7085a3d922e7b3cad47 | |||
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.
This is intended to fix the customer testing.
|
|
||
| static FlutterError? _semanticsMenu(SemanticsNode node) { | ||
| if (node.childrenCount < 1) { | ||
| return FlutterError('a menu cannot be empty'); |
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 think a menu can be empty if we have filter behavior, so I removed this check.
|
|
||
| @override | ||
| Widget buildAnchor(BuildContext context) { | ||
| final Widget? overlayPortal = |
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.
Why this change?
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.
We want the menu button and the menu have a parent-children relationship, but for OverlayPortal, its child and overlayChildBuilder are siblings relationship. To construct parent-children relationship, we use RawMenuAnchor.builder as the parent to wrap OverlayPortal which is constructed by RawMenuAnchor.child and RawMenuAnchor.overlayBuilder.
The disadvantage for this change is, if either widget.child or widget.builder is null, we are not able to have the parent-children relationship, but SubmenuButton is implemented by using both, so it should be okay.
|
Breaking change page: flutter/website#11881 |
…o aria roles (flutter#165596)" This reverts commit 417f47f.
…o aria roles (flutter#165596)" This reverts commit 417f47f.
…o aria roles (#165596)" (#168339) This reverts commit 417f47f. Fixes #168185 ## Pre-launch Checklist - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [ ] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] 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
Reverts #11881 because flutter/flutter#165596 is reverted.
…o aria roles (flutter#165596)" (flutter#168339) This reverts commit 417f47f. Fixes flutter#168185 ## Pre-launch Checklist - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [ ] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] 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
…oles (flutter#165596) This PR is to wire up `MenuAnchor` related widgets to SemanticsRole. * When use `MenuAnchor` and a menu is opened, the menu has `SemanticsRole.menu`. * `MenuBar` has `SemanticsRole.menuBar` * `MenuItemButton` has `SemanticsRole.menuItem` * `SubmenuButton` has `SemanticsRole.menuItem` with `aria-haspopup` attribute setup. * `CheckboxMenuButton` has `SemanticsRole.menuItemCheckbox` * `RadioMenuButton` has `SemanticsRole.menuItemRadio` This PR also includes some changes related to `OverlayPortal` and `RawMenuAnchor` so the "button" and the "menu" that the button opens has a "parent-children" relationship. Previously, they are siblings relationship which will cause some navigation issue in a11y. ## 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.
…7754) This pulls in the 4 commits below: flutter/tests@8be7209...c9cbc60 2025-04-24 [email protected] Bump Zulip pin to update sliver z-order tests (flutter/tests#456) 2025-04-17 [email protected] Revert "Disable flutter_devtools.test" (flutter/tests#455) 2025-04-15 [email protected] Update zulip hash to pick up version that can be analyzed cleanly. (flutter/tests#453) 2025-04-15 [email protected] Disable flutter_devtools.test (flutter/tests#452) (using the command from 5ce5251 / flutter#162763 to make the log). The two changes from 2025-04-15 had been here since db68c95 (flutter#16721), but then it looks like they were accidentally reverted earlier today by 417f47f (flutter#165596). The change from 04-17 doesn't appear to have made it here to flutter/flutter yet. The latest change just went into flutter/tests today and is why I'm making this PR. ## 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]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] 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
This PR is to wire up
MenuAnchorrelated widgets to SemanticsRole.MenuAnchorand a menu is opened, the menu hasSemanticsRole.menu.MenuBarhasSemanticsRole.menuBarMenuItemButtonhasSemanticsRole.menuItemSubmenuButtonhasSemanticsRole.menuItemwitharia-haspopupattribute setup.CheckboxMenuButtonhasSemanticsRole.menuItemCheckboxRadioMenuButtonhasSemanticsRole.menuItemRadioThis PR also includes some changes related to
OverlayPortalandRawMenuAnchorso the "button" and the "menu" that the button opens has a "parent-children" relationship. Previously, they are siblings relationship which will cause some navigation issue in a11y.Pre-launch Checklist
///).