angular / angular/components

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

Abierto
#30,888 10 comentarios 0 reacciones 0 asignados Ver en GitHub
area: material/menu P4
Lenguaje dominante
TypeScript
Estrellas
25k
Forks
6.8k
Merge medio
1 d 8 h
PR fusionados (30 d)
91

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con la reproducción de StackBlitz en src/app/menu-nested-example.ts y haz la ventana lo suficientemente pequeña para que el menú anidado aparezca encima de su activador. Toca el activador y verifica que el menú se abra sin cerrarse inmediatamente ni activar el elemento situado bajo el cursor; el fix debe preservar el comportamiento esperado en las versiones de Angular y CDK/Material indicadas.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
angular, typescript
Área
frontend
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.