Repository navigation
Announce PopupMenuButton with a child as a button - #191700
Closed
kaluli123123 wants to merge 1 commit into
Closed
kaluli123123 wants to merge 1 commit into
kaluli123123 wants to merge 1 commit into
Conversation
PopupMenuButton only exposed button semantics when it built its own IconButton. When a `child` was supplied, the widget just wrapped the child in a Tooltip and an InkWell, so the semantics node had a tap action but no button flag and no enabled state. Assistive technologies therefore did not announce it as a button, and disabled buttons looked enabled. The `expanded` state was also dropped entirely when `ButtonStyle.tapTargetSize` was `MaterialTapTargetSize.padded`, because that branch returned early before the `Semantics` wrapper was added. The `child` branch now always wraps the result in a single `Semantics` widget that marks the popup menu button as a button, reports the enabled state and keeps the expanded state, for both tap target sizes. Fixes flutter#147043
|
This pull request contains changes to Material or Cupertino, which are currently frozen in this repository. Changes should be made in Please refer to #188444 for instructions. |
15 tasks done
Contributor
Author
|
Material is frozen in flutter/flutter (see #188444), so this is ported to flutter/packages instead: flutter/packages#12585. Closing this in favor of that PR. |
QuncCccccc
pushed a commit
to kaluli123123/packages
that referenced
this pull request
Sep 14, 2026
PopupMenuButton only exposed button semantics when it built its own IconButton. When a child was supplied, the widget just wrapped the child in a Tooltip and an InkWell, so the semantics node had a tap action but no button flag and no enabled state. Assistive technologies therefore did not announce it as a button, and disabled buttons looked enabled. The expanded state was also dropped entirely when ButtonStyle.tapTargetSize was MaterialTapTargetSize.padded, because that branch returned early before the Semantics wrapper was added. The child branch now always wraps the result in a single Semantics widget that marks the popup menu button as a button, reports the enabled state and keeps the expanded state, for both tap target sizes. Ported from flutter/flutter#191700, which is blocked by the Material code freeze. Fixes flutter/flutter#147043
auto-submit Bot
pushed a commit
to flutter/packages
that referenced
this pull request
Sep 19, 2026
Ports flutter/flutter#191700, which is blocked by the Material/Cupertino code freeze in flutter/flutter (see flutter/flutter#188444). ## Original description `PopupMenuButton` only exposed button semantics when it built its own `IconButton`. When a `child` was supplied, the widget just wrapped the child in a `Tooltip` and an `InkWell`, so the semantics node had a tap action but no button flag and no enabled state. Assistive technologies therefore did not announce it as a button, and disabled buttons looked enabled. The `expanded` state was also dropped entirely when `ButtonStyle.tapTargetSize` was `MaterialTapTargetSize.padded`, because that branch returned early before the `Semantics` wrapper was added. The `child` branch now always wraps the result in a single `Semantics` widget that marks the popup menu button as a button, reports the enabled state, and keeps the expanded state for both tap target sizes. Fixes flutter/flutter#147043 ## Test plan ## Pre-Review Checklist The change uses the repository's pending changelog workflow (`packages/material_ui/pending_changelogs/change_2026_08_25_port191700.yaml`). No public API documentation change is needed. [^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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PopupMenuButton only exposed button semantics when it built its own
IconButton. When a
childwas supplied, the widget just wrapped thechild in a Tooltip and an InkWell, so the semantics node had a tap
action but no button flag and no enabled state. Assistive technologies
therefore did not announce it as a button, and disabled buttons looked
enabled. The
expandedstate was also dropped entirely whenButtonStyle.tapTargetSizewasMaterialTapTargetSize.padded, becausethat branch returned early before the
Semanticswrapper was added.The
childbranch now always wraps the result in a singleSemanticswidget that marks the popup menu button as a button, reports the enabled
state and keeps the expanded state, for both tap target sizes.
Fixes #147043
Pre-launch Checklist
///).