angular / angular/components

bug(cdkMenu): cdkMenu is scrolled down when max-height is set

Aperta
#29,776 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
area: cdk/menu P4
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:
![image](https://github.com/user-attachments/assets/de4088d6-9839-4b10-afc6-4c55f287a2a1)
Good:
![image](https://github.com/user-attachments/assets/a72de3ed-76a1-4f4f-b5ea-815fec658a56)

### 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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.