angular / angular/components

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

Aperta
#27,895 1 commento 3 reazioni 0 assegnatari Vedi su GitHub
area: material/menu P3
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Riproduci il problema usando l’esempio StackBlitz collegato, verificando innanzitutto i casi di ancoraggio mat-menu-item e CDK menu item descritti nei passaggi. Il lavoro è completo quando gli ancoraggi disabilitati non invocano più il gestore click né eseguono la navigazione tramite routerLink, mentre il normale caso href continua a comportarsi come previsto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.