Skip to content

Add adaptive vertical positioning to RenderFollowerLayer - #157921

Closed
bleroux wants to merge 1 commit into
flutter:masterfrom
NevercodeHQ:fix_dropdown_menu_bottom_overflow
Closed

bleroux wants to merge 1 commit into
flutter:masterfrom
NevercodeHQ:fix_dropdown_menu_bottom_overflow

Conversation

@bleroux

@bleroux bleroux commented Oct 31, 2024

Copy link
Copy Markdown
Contributor

Description

This PR adds adaptive positioning to Leader/Follower.
Doing so a follower position can be automatically modified if not enough space is available.

For the moment, only bottom overflow is implemented as it corresponds to DropdownMenu use case.

Context

Since #154667, DropdownMenu relies on Leader/Follower approach in order to position the menu below the text field.
While this change was needed to fix several positioning issues where the menu did not move while the text field did, it also introduced a regression as the menu is always positioned below the text field and might not be visible or be partially visible.

This PR aims to fix this issues by adding an adaptive positioning logic at the Leader/Follower level. Doing so this logic would be reusable for other widgets (for instance Autocomplete which faces the same problem).

Related Issue

Fixes DropdownMenu menu always appears below the TextField

Tests

Adds 6 tests.

@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 Oct 31, 2024
@bleroux
bleroux marked this pull request as draft October 31, 2024 16:15
@flutter-dashboard

Copy link
Copy Markdown

This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@bleroux
bleroux force-pushed the fix_dropdown_menu_bottom_overflow branch 2 times, most recently from 3b00bb1 to 7e2dad5 Compare November 5, 2024 11:04
@bleroux
bleroux force-pushed the fix_dropdown_menu_bottom_overflow branch from 7e2dad5 to 59c4d84 Compare November 5, 2024 11:18
github-merge-queue Bot pushed a commit that referenced this pull request Nov 23, 2024
## 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:
- #157916
- #158924

Because #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:
- #157921
- #158255

## Related Issue

Fixes #157916
Fixes #158924

Reopens #123395
Reopens #149037
Reopens #151856
flutteractionsbot pushed a commit to flutteractionsbot/flutter that referenced this pull request Nov 25, 2024
…#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
@bleroux

bleroux commented Jan 8, 2025

Copy link
Copy Markdown
Contributor Author

Closing and I will revisit once #158255 will land.

@bleroux bleroux closed this Jan 8, 2025
@bleroux
bleroux deleted the fix_dropdown_menu_bottom_overflow branch February 24, 2025 10:37
@pathconnected

pathconnected commented May 12, 2025 •

Copy link
Copy Markdown
Contributor

Hi @bleroux, was this effort abandoned?

@bleroux

bleroux commented May 12, 2025

Copy link
Copy Markdown
Contributor Author

@pathconnected This is tricky to implement correctly. I might get some bandwidth to work again on this in the coming weeks.

chunhtai pushed a commit to chunhtai/packages that referenced this pull request Jun 12, 2026
## Description

This PR removes `DropdownMenu` usage of Leader/Follower.

Leader/Follower positioning was introduced in
flutter/flutter#154667 which uses
Leader/Follower approach to fix some weird positioning issues (such as
flutter/flutter#149037).

Unfortunately, it also introduces some regressions, see:
- flutter/flutter#157916
- flutter/flutter#158924

Because flutter/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/flutter#157921
- flutter/flutter#158255

## Related Issue

Fixes flutter/flutter#157916
Fixes flutter/flutter#158924

Reopens flutter/flutter#123395
Reopens flutter/flutter#149037
Reopens flutter/flutter#151856
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.

DropdownMenu menu always appears below the TextField

2 participants