-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Do not rely on Leader/Follower to position DropdownMenu menu #158930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not rely on Leader/Follower to position DropdownMenu menu #158930
Conversation
Seems like there is a tradeoff here, and we need to decide which set of bugs is more detrimental to the user. The regressions look like they are annoying, but the issues that this reopens are also pretty bad: they hide the dropdown on a mobile device because the keyboard covers up the menu, and the menu gets disconnected from the anchor when scrolling. Are you expecting that the two other PRs referenced will fix the reopened issues, or are they just related? Also, the "Fixes" section in this PR description seem to refer to the PRs, not the bugs, so you might want to update the numbers there. |
Thanks for the feedback 🙏 (I have edited the description to fix the two links in the "fixes" section, thank for noticing this).
Yes, there is a tradeoff. The main reason I filed this PR is that we are probably close to a stable release and I think this has an impact on the decision.
One of the PR,, is a direct attempt to fix the first regression. But it is still a draft and It might take time to discuss and review this solution and it probably needs more work because being able to move the menu above the field is a good first step but not as smart as the current positioning logic that MenuAnchor offers when not using Leader/Follower. The second PR introduces RawMenuAnchor in the widget library, I don't think it will fix the reopened issues. But it might help. It is a promising and huge PR so it might takes time to review it. In summary, there are pending work that will help to fix the referenced regressions, but the corresponding PRs might not be ready for the next stable release. |
Option 1: Close this PRDownside: We'll be stuck with the following two issues. What would be the long term plan for addressing these if we go with this option? #157916: DropdownMenu menu always appears below the TextField #158924: Cannot scroll to the bottom of DropdownMenu Option 2: Merge this PRThe above two issues will be fixed, but the following ones will be reopened. They might be fixed with work in progress in #157921 and #158924, but those probably won't be done by the next release. #123395: Menu appears behind the keyboard #149037: DropdownMenu Entries Not Positioned Correctly on Keyboard Appearance #151856: DropdownMenu doesn't follow in scrollable So what should we do?It looks to me like option 2 gets us in a better state. The issues we'd have are ugly but not app-breaking. Also, we seem to have a potential path forward to fixing them with #157921 and #158924. I say we merge this PR and then follow up on making sure those issues get fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
See my thoughts in the previous comment. I'm definitely open to being corrected but I think merging this is the best of two imperfect options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@itsjustkevin The two PRs that this reverts (#157916 and #158924) have already rolled into beta, so this PR should be cherry picked into beta if possible. |
…#158930) ## Description This PR removes `DropdownMenu` usage of Leader/Follower. Leader/Follower positioning was introduced in flutter#154667 which uses Leader/Follower approach to fix some weird positioning issues (such as flutter#149037). Unfortunately, it also introduces some regressions, see: - flutter#157916 - flutter#158924 Because flutter#154667 is already included in the beta channel, cherry-picking this PR should be considered. ## Context This PR is not a full revert and keeps Leader/Follower usage in `MenuAnchor` because this usage is optional and doesn't cause any regression. There are some ongoing work which might fix or mitigate this problem: - flutter#157921 - flutter#158255 ## Related Issue Fixes flutter#157916 Fixes flutter#158924 Reopens flutter#123395 Reopens flutter#149037 Reopens flutter#151856
…#159436) This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request) Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request. ### Issue Link: What is the link to the issue this cherry-pick is addressing? #157916 and #158924 ### Changelog Description: Explain this cherry pick in one line that is accessible to most Flutter developers. See [best practices](https://github.com/flutter/flutter/blob/main/docs/releases/Hotfix-Documentation-Best-Practices.md) for examples Restore the previous dropdown menu positioning logic. ### Impact Description: What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping production app (the app crashes on launch) DropdownMenu menu is misplaced and can be fully or partially hidden. See #158930 (comment) for more context. ### Workaround: Is there a workaround for this issue? No ### Risk: What is the risk level of this cherry-pick? - [x] Low - [ ] Medium - [ ] High ### Test Coverage: Are you confident that your fix is well-tested by automated tests? - [x] Yes - [ ] No ### Validation Steps: What are the steps to validate that this fix works? < Replace with validation steps here > Co-authored-by: Bruno Leroux <[email protected]>
Description
This PR removes
DropdownMenu
usage of Leader/Follower.Leader/Follower positioning was introduced in #154667 which uses Leader/Follower approach to fix some weird positioning issues (such as #149037).
Unfortunately, it also introduces some regressions, see:
DropdownMenu
#158924Because #154667 is already included in the beta channel, cherry-picking this PR should be considered.
Context
This PR is not a full revert and keeps Leader/Follower usage in
MenuAnchor
because this usage is optional and doesn't cause any regression.There are some ongoing work which might fix or mitigate this problem:
Related Issue
Fixes #157916
Fixes #158924
Reopens #123395
Reopens #149037
Reopens #151856