angular / angular/components

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

Đang mở
#27,913 2 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

area: material/menu P4
Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
91

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với hai điểm vào để tái hiện, src/app/cdk-menu-standalone-menu-example.ts và src/app/menu-icons-example.ts, đồng thời so sánh hành vi của CDK menu và mat-menu khi nhấp chuột phải ở bên ngoài. Theo dõi cách xử lý thao tác nhấp bên ngoài đối với từng menu và xác định hành vi nào cần được đồng nhất. Hoàn thành khi cả hai ví dụ hoạt động nhất quán khi được kiểm tra trong Chrome.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
frontend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.