angular / angular/components

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

Đang mở
#30,888 10 bình luận 0 reaction 0 người được giao Xem trên GitHub
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 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

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

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

Hướng nghiên cứu

Bắt đầu với bản reproduction trên StackBlitz trong src/app/menu-nested-example.ts và thu nhỏ cửa sổ đủ để menu lồng nhau xuất hiện phía trên trigger của nó. Nhấn vào trigger và xác minh rằng menu mở ra mà không ngay lập tức đóng lại hoặc kích hoạt item bên dưới con trỏ; fix phải duy trì hành vi mong đợi trên các phiên bản Angular và CDK/Material được báo cáo.

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
35/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.