angular / angular/components

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

Offen
#27,913 2 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: material/menu P4
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit den beiden Reproduktions-Einstiegspunkten src/app/cdk-menu-standalone-menu-example.ts und src/app/menu-icons-example.ts und vergleiche das Verhalten von CDK menu und mat-menu beim Rechtsklick außerhalb. Verfolge die Behandlung von Klicks außerhalb für jedes Menü und ermittle, welches Verhalten angeglichen werden sollte. Als erledigt gilt die Aufgabe, wenn sich beide Beispiele bei der Untersuchung in Chrome konsistent verhalten.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
frontend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.