Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rlexa opened this issue Feb 13, 2018 · 2 comments · Fixed by #10005
Closed

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

rlexa opened this issue Feb 13, 2018 · 2 comments · Fixed by #10005
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@rlexa
Copy link

rlexa commented Feb 13, 2018

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
Copy link
Author

rlexa commented Feb 15, 2018

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?).

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent has pr labels Feb 18, 2018
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 18, 2018
Currently the lazily-rendered content is maintained in the background while a menu is open. These changes switch to detaching it once the user closes the menu.

Fixes angular#9915.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 18, 2018
Currently the lazily-rendered content is maintained in the background while a menu is open. These changes switch to detaching it once the user closes the menu.

Fixes angular#9915.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 25, 2018
Currently the lazily-rendered content is maintained in the background while a menu is open. These changes switch to detaching it once the user closes the menu.

Fixes angular#9915.
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 1, 2018
Currently the lazily-rendered content is maintained in the background while a menu is open. These changes switch to detaching it once the user closes the menu.

Fixes angular#9915.
tinayuangao pushed a commit that referenced this issue Mar 2, 2018
…0005)

Currently the lazily-rendered content is maintained in the background while a menu is open. These changes switch to detaching it once the user closes the menu.

Fixes #9915.
tinayuangao pushed a commit that referenced this issue Mar 5, 2018
…0005)

Currently the lazily-rendered content is maintained in the background while a menu is open. These changes switch to detaching it once the user closes the menu.

Fixes #9915.
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants