angular / angular/components

bug(MatMenu): Menu item with menuTrigger combine with menu item in sub component does not clos sub menu

Aperta
#27,962 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
area: material/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

![image](https://github.com/angular/components/assets/6987117/f79c0a39-5f3e-4ccc-b888-30b3d3a8038a)

A mat-menu, using a `mat-menu-item` with a `matMenuTriggerFor` next to a menu-item in a sub component does not properly closes sub menu and handle highlighted item on mouse over.

### Reproduction

StackBlitz link: https://stackblitz.com/edit/x3u2hh?file=src%2Fexample%2Fmenu-nested-example.html
Steps to reproduce:
1. Open menu by clicking _Animal index_ button
2. Mouse Over _Vertebrates_ menu, the sub menu opens
3. Mouse Over _Menu item component_

### Expected Behavior

The Vertebrates sub menu should close and Vertebrates menu should no longer be highlighted
only menu-item _Menu item component_ should be highlighted

### Actual Behavior

The Vertebrates sub menu is still open and Vertebrates menu is still highlighted along with _Menu item component_

### Environment

- Angular: 16.1
- CDK/Material: 16.2.9
- Browser(s): chrome / Edge
- Operating System (e.g. Windows, macOS, Ubuntu): Windows 11

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con la riproduzione collegata di StackBlitz, in particolare src/example/menu-nested-example.html, e riproduci la sequenza di hover per il mat-menu annidato. Traccia l’interazione tra menu-item e matMenuTriggerFor per determinare perché l’elemento padre rimane evidenziato e aperto; il lavoro è completato quando il sottomenu Vertebrates si chiude e solo Menu item component rimane evidenziato.

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.