angular / angular/components

bug(CdkMenuItem): Main menu closes after clicking on a menu item that is a menu

Open
#30,050 4 comments 2 reactions 0 assignees View on GitHub
area: cdk/menu P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

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

Clicking on a menu item that is also a menu will close the whole menu, instead of closing only the opened submenu.

### Reproduction

StackBlitz link: https://stackblitz.com/edit/4aortd
Steps to reproduce:
1. Click on `File` button
2. Click on `New` menu item

### Expected Behavior

The submenu for the `New` menu item is closed (or kept open), the menu associated with `File` is kept open (like a `CdkMenuBar` or the menu nested example: https://material.angular.io/components/menu/examples#menu-nested)

### Actual Behavior

The submenu for the `New` menu item is closed and the `File` menu is closed as well.

### Environment

- Angular: 19.0.0
- CDK/Material: 19.0.0
- Browser(s): 131.0.6778.70 (Official Build) (64-bit)
- Operating System (e.g. Windows, macOS, Ubuntu): Windows 10 Pro

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and follow the File > New interaction described in the issue. Trace the menu-item and submenu closing behavior in the Angular CDK menu implementation, then verify that closing New leaves File open, using the nested-menu and CdkMenuBar examples as behavioral references.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.