Qun Cheng e89075c112
Announce text and button together when DropdownMenu is treated as a button (#176428)
Fixes https://github.com/flutter/flutter/issues/175950.

This PR is to make screen reader announce the text field content and the
trailing button together on `DropdownMenu`. When the `DropdownMenu`
cannot be focused (`canRequestFocus()` is set to false), the "text
field" should be treated as if it is a button, and the trailing button
should **not** be announced separately. When the text field is
focusable, it's reasonable to separate text field and the trailing
button, so I leave it as is.

The native app doesn't announce "expanded"/"collapsed", so I use
`Semantics.hint` to achieve the goal.

This demo is to show the screen reader announcement.


https://github.com/user-attachments/assets/e7a9da8f-acf8-4018-a778-1ded1b07103c




## 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.
2025-10-09 21:35:21 +00:00
..