angular / angular/components

bug(CdkMenuItem): Main menu closes after clicking on a menu item that is a menu

Aperta
#30,050 4 commenti 2 reazioni 0 assegnatari Vedi su GitHub
area: cdk/menu P3
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

Clicking on a menu item that is also a menu will close the whole menu, instead of closing only the opened submenu.

### Reproduction

StackBlitz link: https://stackblitz.com/edit/4aortd
Steps to reproduce:
1. Click on `File` button
2. Click on `New` menu item

### Expected Behavior

The submenu for the `New` menu item is closed (or kept open), the menu associated with `File` is kept open (like a `CdkMenuBar` or the menu nested example: https://material.angular.io/components/menu/examples#menu-nested)

### Actual Behavior

The submenu for the `New` menu item is closed and the `File` menu is closed as well.

### Environment

- Angular: 19.0.0
- CDK/Material: 19.0.0
- Browser(s): 131.0.6778.70 (Official Build) (64-bit)
- Operating System (e.g. Windows, macOS, Ubuntu): Windows 10 Pro

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con la riproduzione StackBlitz collegata e segui l’interazione File > New descritta nell’issue. Traccia il comportamento di chiusura degli elementi di menu e dei sottomenu nell’implementazione dei menu di Angular CDK, quindi verifica che la chiusura di New lasci File aperto, usando gli esempi nested-menu e CdkMenuBar come riferimenti comportamentali.

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
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.