components icon indicating copy to clipboard operation
components copied to clipboard

<mat-menu> content is active even if not opened

Open rlexa opened this issue 8 years ago • 2 comments

Bug, feature request, or proposal:

Bug

What is the expected behavior?

So long as the menu is not opened I would expect the mat-menu content to not be active (similar to *ngIf="false" directive).

What is the current behavior?

Even if ng-template matMenuContent is used after the menu was opened once and the menu is currently not opened, mat-menu content seems to be active i.e. the components therein seem to be rendered as far as Angular is concerned according to e.g. property getter breakpoints.

What are the steps to reproduce?

Providing a StackBlitz reproduction is the best way to share your issue.
https://stackblitz.com/edit/angular-material2-issue-9dp31o
Couldn't use ng-template matMenuContent here, but even with it in the newer version after opening and closing once content stays active.

What is the use-case or motivation for changing an existing behavior?

Motivation is reducing of unnecessary performance hits (in fact I found that out looking at the Chrome performance devtools).

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 5.2.0, Material 5.2.0, Windows, TS 2.5.3, Chrome.

Is there anything else we should know?

rlexa avatar Feb 13 '18 11:02 rlexa

BTW same problem with mat-select's mat-option elements i.e. are active even though select popup is not opened (maybe even the same issue if is using same menu popup code?).

rlexa avatar Feb 15 '18 13:02 rlexa

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.