Skip to content

bug(menu): [matMenuTriggerFor] does not update aria-expanded on close in OnPush component #26262

Closed
@ajafff

Description

@ajafff

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

matMenuTrigger fails to mark host component dirty after menu closed

Reproduction

Steps to reproduce:

  1. https://stackblitz.com/edit/angular-bqrgp1?file=src%2Fapp%2Fmenu-overview-example.ts
  2. open menu: trigger correctly has aria-expanded="true"
  3. close menu: trigger still has aria-expanded="true"
  4. after removing OnPush, it works as expected

Expected Behavior

aria-expanded is updated after menu is closed

Actual Behavior

aria-expanded is only updated when change detection happens next time in the component (triggered by input change or event firing inside the template)

Environment

  • Angular: 15.0.3
  • CDK/Material: 15.0.2
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions