Skip to content

bug(cdk Menu / Portal): Portal/Menu isAttached() not working in ShadowDOM #26107

@chladog

Description

@chladog

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

When CDK Menu is placed in component inside ShadowDom-encapsulated component, the menu trigger does open the menu, but does not toggle it (when it's open then the click doesn't closes it).
I tracked the issue down through cdk Menu -> overlayRef -> PortalOutlet -> isAttached()

Reproduction

Steps to reproduce:

  1. Have ShadowDom component
  2. Put Angular CDK Menu in this component
  3. Try to toggle cdkMenuTriggerFor

Expected Behavior

Should work same as when not in ShadowDom component.

Actual Behavior

cdkMenuTriggerFor inside ShadowDom doesn't toggle Menu.

Here is the stackblitz with reproducted bug:
https://stackblitz.com/edit/angular-ivy-rq5d9a?file=src/app/app.module.ts

Stackblitz is ng 14, but this bug is still there in Angular 15.

Environment

  • Angular: 15^
  • CDK/Material: 15^

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions