Skip to content

fix(aria/menu): remove aria-label binding from menu item value#32894

Closed
mhoechtl wants to merge 1 commit intoangular:mainfrom
mhoechtl:fix-menu-item-aria-label
Closed

fix(aria/menu): remove aria-label binding from menu item value#32894
mhoechtl wants to merge 1 commit intoangular:mainfrom
mhoechtl:fix-menu-item-aria-label

Conversation

@mhoechtl
Copy link
Copy Markdown

@mhoechtl mhoechtl commented Mar 5, 2026

Removes the [attr.aria-label]="value()" host binding from ngMenuItem.

Binding value to aria-label causes several issues:

  1. Couples application logic/data (value) with UI accessibility state.
  2. Creates i18n issues if the value is a non-localized identifier.
  3. Overwrites explicitly provided aria-label attributes on the host element.
  4. Overrides the native accessible name derivation (textContent) of the menuitem.

Fixes #32893

Removes the `[attr.aria-label]="value()"` host binding from `ngMenuItem`.

Binding `value` to `aria-label` causes several issues:
1. Couples application logic/data (value) with UI accessibility state.
2. Creates i18n issues if the value is a non-localized identifier.
3. Overwrites explicitly provided `aria-label` attributes on the host element.
4. Overrides the native accessible name derivation (textContent) of the menuitem.

Fixes angular#32893
@pullapprove pullapprove Bot requested review from ok7sai and wagnermaciel March 5, 2026 23:09
Copy link
Copy Markdown
Member

@ok7sai ok7sai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! The label input overwrites the aria-label is certainly an unwanted behavior.

@ok7sai ok7sai added target: minor This PR is targeted for the next minor release action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Apr 27, 2026
@crisbeto
Copy link
Copy Markdown
Member

crisbeto commented May 5, 2026

I ended up taking this over in #33202 since we had some internal clients asking for it.

@crisbeto crisbeto closed this May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(aria/menu): menu item erroneously binds value to aria-label

3 participants