angular / angular/components

bug(menu): Right click closes CDK Menu but not Component Menu

Aperta
#27,913 2 commenti 2 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 mat-menu is opened and the user right clicks anywhere outside the mat-menu it does not close. Whereas for the cdkMenu when you right click outside the menu it close it. Is this the expected behaviour?

And is there any way to make the cdkMenu behave the same as mat-menu?

This makes inspecting the cdkMenu/cdkMenuItem etc. very hard as the menu disappears in the dom before I can open the console and inspect it.

### Reproduction

StackBlitz link: https://stackblitz.com/run?file=src%2Fapp%2Fcdk-menu-standalone-menu-example.ts
Steps to reproduce:
1. Open the cdkMenu
2. Right click outside the menu
3. The menu closes

StackBlitz link: https://stackblitz.com/run?file=src%2Fapp%2Fmenu-icons-example.ts
Steps to reproduce:
1. Open the mat-menu
2. Right click outside the menu
3. The menu stays open

### Expected Behavior

I expect the cdkMenu and mat-menu to behave the same

### Actual Behavior

cdkMenu and mat-menu do not behave the same when right clicking outside the menu.

### Environment

- Angular: 16
- CDK/Material: 16
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia dai due punti di ingresso per la riproduzione, src/app/cdk-menu-standalone-menu-example.ts e src/app/menu-icons-example.ts, e confronta il comportamento di CDK menu e mat-menu quando si fa clic con il pulsante destro al di fuori. Traccia la gestione dei clic esterni per ciascun menu e determina quale comportamento dovrebbe essere allineato. Il lavoro è completato quando entrambi gli esempi si comportano in modo coerente durante l’ispezione in Chrome.

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.