angular / angular/components

bug(matMenuTriggerFor): nested menu element is activated right away if it appears above its trigger

Aperta
#30,888 10 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

When a nested menu element appears above its trigger `mat-menu-item` it is activated right away.

### Reproduction

StackBlitz link: https://stackblitz.com/run?file=src%2Fapp%2Fmenu-nested-example.ts
Steps to reproduce:
1. Make the window small enough for the nested menu to appear above the trigger (e.g. using chrome dev tools).
2. Tap (!) the menu trigger

### Expected Behavior

The menu is opened, but the item is not activated

### Actual Behavior

The menu is opened, but closed right away with the item below the cursor activated

### Environment

- Angular: 19 (happens in earlier versions too)
- CDK/Material: 19
- Browser(s):
- Operating System (e.g. Windows, macOS, Ubuntu):
all of them

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con la riproduzione StackBlitz in src/app/menu-nested-example.ts e riduci la finestra quanto basta affinché il menu annidato appaia sopra il suo trigger. Tocca il trigger e verifica che il menu si apra senza chiudersi immediatamente o attivare l'elemento sotto il cursore; il fix deve preservare il comportamento previsto nelle versioni di Angular e CDK/Material segnalate.

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.