angular / angular/components

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

オープン
#30,888 コメント 10 件 リアクション 0 件 担当者 0 名 GitHub で見る
area: material/menu P4
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

src/app/menu-nested-example.ts の StackBlitz reproduction から始め、nested menu がその trigger の上に表示されるほどウィンドウを小さくします。trigger をタップし、menu がすぐに閉じたりカーソルの下にある item をアクティブにしたりせずに開くことを確認します。この fix では、報告されている Angular および CDK/Material の各バージョンで期待される動作を維持する必要があります。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。