components
components copied to clipboard
bug(cdkMenu): cdkMenu is scrolled down when max-height is set
trafficstars
Is this a regression?
- [ ] Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
When using max-height on cdkMenu with overflow-y: auto, menu is scrolled down a bit when first shown.
Bad:
Good:
Reproduction
StackBlitz link: https://stackblitz.com/edit/gbirs4?file=src/example/cdk-menu-standalone-menu-example.html,src/example/cdk-menu-standalone-menu-example.css Steps to reproduce:
- Add cdk menu with options with at least one cdkMenuHeaderItem.
- Set max-height on cdkMenu.
- Open menu.
Expected Behavior
Menu should not be scrolled at all.
Actual Behavior
Menu is scrolled a bit down.
Environment
- Angular: 18.2.2
- CDK/Material: 18.2.2
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): macOS