Skip to content

Conversation

@QuncCccccc
Copy link
Contributor

@QuncCccccc QuncCccccc commented Mar 20, 2025

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

  • 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.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. engine flutter/engine related. See also e: labels. f: material design flutter/packages/flutter/material repository. a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) platform-web Web applications specifically and removed engine flutter/engine related. See also e: labels. a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) platform-web Web applications specifically labels Mar 20, 2025
@QuncCccccc
Copy link
Contributor Author

Once #164439 land, tests will be fixed.

@QuncCccccc QuncCccccc marked this pull request as ready for review March 25, 2025 19:47
@QuncCccccc QuncCccccc force-pushed the menu_anchor_semantcs_role branch from 9b73d1f to 74d845f Compare March 26, 2025 18:18
@github-actions github-actions bot added d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) labels Mar 26, 2025
chrisbobbe added a commit to QuncCccccc/zulip-flutter that referenced this pull request Mar 27, 2025
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]>
@QuncCccccc
Copy link
Contributor Author

Created zulip/zulip-flutter#1443 to fix customer testing.

chrisbobbe added a commit to QuncCccccc/zulip-flutter that referenced this pull request Mar 27, 2025
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]>
@QuncCccccc QuncCccccc force-pushed the menu_anchor_semantcs_role branch from e2a509e to f8a9f49 Compare March 27, 2025 16:49
QuncCccccc added a commit to flutter/tests that referenced this pull request Mar 28, 2025
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.
@QuncCccccc QuncCccccc force-pushed the menu_anchor_semantcs_role branch from f8a9f49 to ae30e5b Compare March 28, 2025 21:41
@QuncCccccc QuncCccccc requested a review from matanlurey as a code owner March 28, 2025 21:43
@@ -1 +1 @@
3566ea0e688123cecc2b605bda13732adc1e610a
8be72094d9b33dae8ff8a7085a3d922e7b3cad47
Copy link
Contributor Author

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');
Copy link
Contributor Author

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.

@QuncCccccc QuncCccccc requested review from chunhtai and removed request for matanlurey March 28, 2025 21:46

@override
Widget buildAnchor(BuildContext context) {
final Widget? overlayPortal =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Contributor Author

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.

@QuncCccccc
Copy link
Contributor Author

QuncCccccc commented Apr 8, 2025

Breaking change page: flutter/website#11881
G3fix: cl/742862470 but want to get approval from the internal team first. LGTMed.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 5, 2025
QuncCccccc added a commit to QuncCccccc/flutter that referenced this pull request May 5, 2025
QuncCccccc added a commit to QuncCccccc/flutter that referenced this pull request May 5, 2025
github-merge-queue bot pushed a commit that referenced this pull request May 6, 2025
…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
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 6, 2025
sfshaza2 pushed a commit to flutter/website that referenced this pull request May 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 6, 2025
mboetger pushed a commit to mboetger/flutter that referenced this pull request May 6, 2025
…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
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
romanejaquez pushed a commit to romanejaquez/flutter that referenced this pull request Aug 14, 2025
…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.
romanejaquez pushed a commit to romanejaquez/flutter that referenced this pull request Aug 14, 2025
…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
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants