-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Mat menu height gets shrinked when scrolled out of view #18168
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
Comments
I also came across this issue and I'd appreciate the fix... |
Any updates on this one? Or do you guys have found any workarounds? |
For me it worked what I mentioned at the end of my report, see below as well.
|
Ty, I have found temporary solution in another issue #13988. It has done the job for now. |
Currently the menu only shrinks if the users scrolls after it has been opened, but if they scroll back to a place where there's enough place to fit the content, the menu will stay collapsed. These changes adjust the config so the menu can grow after it was opened. Fixes angular#18168. Fixes angular#13988.
Currently the menu only shrinks if the users scrolls after it has been opened, but if they scroll back to a place where there's enough place to fit the content, the menu will stay collapsed. These changes adjust the config so the menu can grow after it was opened. Fixes #18168. Fixes #13988. (cherry picked from commit 83f2adc)
Currently the menu only shrinks if the users scrolls after it has been opened, but if they scroll back to a place where there's enough place to fit the content, the menu will stay collapsed. These changes adjust the config so the menu can grow after it was opened. Fixes angular#18168. Fixes angular#13988.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
Bug
What is the expected behavior?
When an opened menu is scrolled out of the view, and it's scrolled back to the view, then it should have the original height.
What is the current behavior?
When an opened menu is scrolled out of the view, and it's scrolled back to the view, then it loses it's original height and gets shrinked to the height of one menu-item.
What are the steps to reproduce?
Stackblitz example:
I used the original mat-menu example from the angular.material.io and just slightly modified the html by adding some extra content to make it scrollable.
Just open the link and see the menu trigger on the middle of the page and do the reproduction steps. Furthermore see the attached gif below.
https://stackblitz.com/edit/angular-rnvofb-2d2zsm?file=src%2Fapp%2Fmenu-overview-example.html
What is the use-case or motivation for changing an existing behavior?
To fix the issue mentioned above
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
@angular/material ~8.2.2
Is there anything else we should know?
Tested it in chrome.
Possible solution can be: (only checked it in browser console, but it worked)
Call the withGrowAfterOpen(true) on the position builder when the related overlay config is retrieved for the overlay. This overlay config instantiated inside the _getOverlayConfig() function in the menu.trigger.ts.
So it would look like this:
My current temporary solution is setting the min height for the connected position overlay element (with class "cdk-overlay-connected-position-bounding-box") to equal with it's height after opening, but it's quite a hack as I get this element from the DOM with getElementsByClassName.
The text was updated successfully, but these errors were encountered: