Skip to content

[material_ui] Fix MenuAnchor scrollbar safe-area padding - #12470

Open
abdullahtas0 wants to merge 2 commits into
flutter:mainfrom
abdullahtas0:agent/fix-menu-anchor-scrollbar-padding
Open

[material_ui] Fix MenuAnchor scrollbar safe-area padding#12470
abdullahtas0 wants to merge 2 commits into
flutter:mainfrom
abdullahtas0:agent/fix-menu-anchor-scrollbar-padding

Conversation

@abdullahtas0

@abdullahtas0 abdullahtas0 commented Aug 13, 2026

Copy link
Copy Markdown

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

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. 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.

Footnotes

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

@github-actions github-actions Bot added triage-framework Should be looked at in framework triage p: material_ui 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
abdullahtas0 marked this pull request as ready for review August 13, 2026 21:44

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request prevents MenuAnchor scrollbars from inheriting system safe-area padding by removing padding from the MediaQuery surrounding the Scrollbar and restoring it for the inner scroll view. A regression test and a changelog entry are also included. The feedback suggests optimizing the implementation by using mediaQuery.removePadding(...) directly on the already retrieved MediaQueryData instance, avoiding redundant MediaQuery.of(context) lookups.

Comment thread packages/material_ui/lib/src/menu_anchor.dart Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p: material_ui triage-framework Should be looked at in framework triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scrollbar of MenuAnchor works incorrectly

1 participant