angular / angular/components

bug(menu): Disabled mat-menu-item on anchor tag still clickable

オープン
#27,895 コメント 1 件 リアクション 3 件 担当者 0 名 GitHub で見る
area: material/menu P3
主要言語
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

A disabled mat-menu-item anchor ie` Anchor` looks disabled but is still clickable.

However a regular href ` Google` works as expected

This occurs with the cdk menu item too.

### Reproduction

StackBlitz link: https://stackblitz.com/edit/32sike?file=src%2Fexample%2Fmenu-icons-example.html
Steps to reproduce:
1. Click the 3 dot menu, click Disabled Anchor Click, 'anchor click' is logged to the console
2. Click the 3 dot menu, click Disabled Anchor RouterLink, NewComponent is rendered in the `router-outlet`

### Expected Behavior

`` should not be clickable

### Actual Behavior

`` is clickable

### Environment

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

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

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

調査の方向性

リンクされた StackBlitz の例を使って問題を再現し、まず手順で説明されている mat-menu-item と CDK menu item のアンカーケースを確認します。無効化されたアンカーが click ハンドラーを呼び出したり routerLink 経由でナビゲーションしたりしなくなり、通常の href ケースが引き続き期待どおりに動作すれば完了です。

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

評価

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

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

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