bug(cdkMenu): cdkMenu is scrolled down when max-height is set
- Lingua principale
- TypeScript
- Stelle
- 25k
- Fork
- 6.8k
- Merge medio
- 1g 8h
- PR unite (30g)
- 91
Descrizione
### 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:
1. Add cdk menu with options with at least one cdkMenuHeaderItem.
2. Set max-height on cdkMenu.
3. 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
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Riproduci il problema usando l’esempio StackBlitz, iniziando da src/example/cdk-menu-standalone-menu-example.html e src/example/cdk-menu-standalone-menu-example.css. Verifica cdkMenu con un cdkMenuHeaderItem e max-height più overflow-y: auto; il lavoro è completato quando il menu si apre senza alcun offset di scorrimento iniziale.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- angular, typescript
- Ambito
- frontend
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 42/100