[material_ui] Port flutter/flutter #185475 "Accessibility: Add semanticLabel to MenuAnchor" (#12806) Ports flutter/flutter#185475 to `material_ui`, following the instructions in flutter/flutter#188444. The commits were cherry-picked from the original PR, with only file paths adjusted for this repo. `MenuAnchor` had no way to label the expanded menu overlay, so screen readers announced nothing useful when a menu opened. This adds a `semanticLabel` property, applied to a `Semantics` node wrapping the submenu in `_buildOverlay`, and only when a label is provided. The original PR also announced the label with `SemanticsService.announce` when the menu opened. Following @chunhtai's review feedback on flutter/flutter#185475, that part is dropped here: a semantics label should not double as announcement text, and anyone who wants an announcement can call `SemanticsService.announce` from `onOpen`. The last commit on this branch removes it. ## Tests New test `MenuAnchor applies semanticLabel to the expanded menu overlay` in `packages/material_ui/test/menu_anchor_test.dart`, checking that the label is absent before the menu opens and present once it expands. The `menu_anchor.0` API example now sets a `semanticLabel`, and its example test still passes. Fixes flutter/flutter#184876 Supersedes flutter/flutter#185475, which will be closed with a pointer to this PR. ## Pre-Review Checklist **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. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
This repo is a companion repo to the main flutter repo. It contains the source code for Flutter's first-party packages (i.e., packages developed by the core Flutter team). Check the packages directory to see all packages.
These packages are also available on pub.
Please file any issues, bugs, or feature requests in the main flutter repo. Issues pertaining to this repository are labeled “package”.
If you wish to contribute a new package to the Flutter ecosystem, please see the documentation for developing packages. You can store your package source code in any GitHub repository (the present repo is only intended for packages developed by the core Flutter team). Once your package is ready you can publish to the pub repository.
If you wish to contribute a change to any of the existing packages in this repo, please review our contribution guide, and send a pull request.
These are the packages hosted in this repository: