Skip to content

bug(aria/menu): itemSelected event is not triggered when selecting an ngMenuItem #32865

@mhoechtl

Description

@mhoechtl

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:

  1. Open the provided StackBlitz link and open the console in the preview panel.
  2. Click on the "Open Menu" button.
  3. Click on the "Mark as read" option. Observe that the console only logs that it was triggered by the standard (click) binding on the ngMenuItem.
  4. 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

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentaria/menu

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions