-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Closed
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/menu
Description
Note: This might be an invalid use case, as it's wrongly using a directive. Still, it wouldn't hurt to have a safety check to prevent this.
Reproduction
Use StackBlitz to reproduce your issue: https://stackblitz.com/edit/angular-japg2m?file=src%2Fapp%2Fmenu-overview-example.html
Steps to reproduce:
<button [matMenuTriggerFor]="menu">Open</button>
<mat-menu #menu="matMenu">
<button [matMenuTriggerFor]="menu">Close</button>
</mat-menu>
- Click "Open"
- Click Close
- Open console and observe fatal error:
ERROR Error: Maximum call stack size exceeded
ERROR Error: Failed to execute 'insertBefore' on 'Node': The new child element contains the parent.
Expected Behavior
Page (main JS thread) shouldn't crash when having a closing button inside the menu.
Actual Behavior
Page (main JS thread) crashes.
Environment
- Angular: 10.x
- CDK/Material: 10.x
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): macOS
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/menu