Skip to content

Fix MenuAnchor scrollbar safe area padding - #191085

Closed
abdullahtas0 wants to merge 1 commit into
flutter:masterfrom
abdullahtas0:agent/fix-menu-anchor-scrollbar-padding
Closed

abdullahtas0 wants to merge 1 commit into
flutter:masterfrom
abdullahtas0:agent/fix-menu-anchor-scrollbar-padding

Conversation

@abdullahtas0

Copy link
Copy Markdown

MenuAnchor's internal Scrollbar inherited the root view's MediaQuery.padding. On devices with system safe-area padding, this inset the thumb inside the already-positioned menu and prevented it from reaching the end of the menu track.

This change removes the view padding for the scrollbar only, while restoring the original MediaQueryData for custom menu content. It also adds a regression test that verifies both behaviors.

Fixes #188155.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the AI contribution guidelines and understand my responsibilities, or I am not using AI tools.
  • 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.
  • Documentation is not required because this does not change a public API.
  • I added a regression test for the change.
  • This is not a breaking change and does not require a data-driven fix.
  • All existing and new tests are passing.

Validation

  • ./bin/flutter test packages/flutter/test/material/menu_anchor_test.dart (171 passed, 1 skipped)
  • ./bin/flutter analyze --no-pub packages/flutter (no issues)
  • ./bin/dart format packages/flutter/lib/src/material/menu_anchor.dart packages/flutter/test/material/menu_anchor_test.dart (no changes)

@github-actions

Copy link
Copy Markdown

This pull request contains changes to Material or Cupertino, which are currently frozen in this repository.

Changes should be made in material_ui and/or cupertino_ui in the flutter/packages repository.

Please refer to #188444 for instructions.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages labels Aug 13, 2026
@google-cla

google-cla Bot commented Aug 13, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@abdullahtas0

Copy link
Copy Markdown
Author

Superseded by flutter/packages#12470. Material framework changes now need to land in the standalone material_ui package, so I am closing this draft in favor of the packages PR.

auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Oct 22, 2026
Material `Scrollbar` uses the surrounding `MediaQuery.padding` as painter padding when no explicit padding is provided. A `MenuAnchor` overlay is already positioned within the safe area, so inheriting the view padding again shortens the scrollbar track and prevents the thumb from reaching its visual end.

This change removes safe-area padding only for the menu's `Scrollbar`, then restores the original `MediaQueryData` below it so custom menu children continue to observe the same media query values as before. It also adds a regression test and a patch changelog entry.

Fixes flutter/flutter#188155.

This supersedes flutter/flutter#191085, which cannot land in `flutter/flutter` because Material framework changes have moved to `material_ui`.

Validation:

- The regression test failed before the source change with a 24 logical pixel bottom scrollbar padding and passes after the change.
- `flutter test test/menu_anchor_test.dart` (171 passed, 1 skipped)
- `flutter analyze --no-pub`
- `flutter_plugin_tools format --packages=material_ui`
- `flutter_plugin_tools validate --packages=material_ui --check-for-missing-changes`

## 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scrollbar of MenuAnchor works incorrectly

1 participant