angular / angular/components

bug(ngMenu): onSelect does not emit values

Open
#32,435 2 comments 3 reactions 1 assignee Claimed by @ok7sai View on GitHub
area: material/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

I tried using Angular Aria's ngMenu based on the [setup from the docs](https://angular.dev/guide/aria/menu#menu-with-trigger) but it doesn't seem to work. The `onSelect` output doesn't emit the selected value.

On the other note, the docs are also not explicitly stating how to actually use any of the components - I had to read the [tests](https://github.com/angular/components/blob/2c0ba8d1498512b1192ccc79476f123a03658a72/src/aria/menu/menu.spec.ts#L947) and the [source code](https://github.com/angular/components/blob/2c0ba8d1498512b1192ccc79476f123a03658a72/src/aria/menu/menu.ts#L221) to be sure what's expected (I know about the API button at the top of the docs page that lists the `onSelect`, but it's not obvious that this is intended way). It would be useful to see a showcase on how to use values from these components.

### Reproduction

StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-whsmfbqs?file=src%2Fmenu-test%2Fmenu-test.html
Steps to reproduce:
1. The relevant implementation is in `src/menu-test/menu-test.html` & `src/menu-test/menu-test.ts`
2. After the menu item is selected (click or enter key) it should be logged into console
3. There's no log in the console. The onSelect didn't emit a value.

### Expected Behavior

The onSelect should emit a value and the value should be a logged in the console.

### Actual Behavior

The onSelect didn't emit a value. There's no log in the console.

### Environment

- Angular: latest ^21.0.1
- ~CDK/Material~ Aria: ^21.0.1
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): macOS

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.