-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
In the @angular/aria/menu directives, the (itemSelected) event is not triggered when an item is selected.
This was tested using the official example setup from the angular/angular repository:
aria/menu-trigger example
When event binding (itemSelected)="onItemSelected($event)" is added, the event handler never fires upon selection in either Firefox or Chrome.
As a functional workaround, binding (click)="onItemSelected('click')" directly to the ngMenuItem triggers the method successfully. However, the native aria/menu event fails to emit entirely.
Reproduction
StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-e7omwbvr?file=src%2Fapp%2Fapp.html
Steps to reproduce:
- Open the provided StackBlitz link and open the console in the preview panel.
- Click on the "Open Menu" button.
- Click on the "Mark as read" option. Observe that the console only logs that it was triggered by the standard
(click)binding on thengMenuItem. - Click on any other option in the menu. Observe that nothing is logged because the
(itemSelected)event is not fired.
Expected Behavior
The (itemSelected) event should emit the selected item/value when a user selects an ngMenuItem via mouse click or keyboard navigation.
Actual Behavior
The (itemSelected) event is not fired at all.
Environment
- Angular: 21.1.5, 21.2.0
- CDK/Material: 21.1.5, 21.2.0
- Browser(s): Firefox, Google Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Arch Linux