components icon indicating copy to clipboard operation
components copied to clipboard

mdTooltip is not working properly with ChangeDetectionStrategy.OnPush

Open aralroca opened this issue 9 years ago • 3 comments

Bug:

Inside a component with changeDetection: ChangeDetectionStrategy.OnPush the mdTooltip is not working properly.

What is the expected behavior?

When the mouse is over the element, the tooltip is showed, and when the mouse leave the element, the tooltip is hidden.

What is the current behavior?

Show the tooltip sometimes when the mouse leave, sometimes never, sometimes when the mouse is over... Is not always the same behavior.

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

Browser: Chrome 55.0.2883.95 (64-bit)

angular-cli: 1.0.0-beta.24
node: 6.7.0
os: darwin x64
@angular/common: 2.4.1
@angular/compiler: 2.4.1
@angular/core: 2.4.1
@angular/forms: 2.4.1
@angular/http: 2.4.1
@angular/material: 2.0.0-beta.1
@angular/platform-browser: 2.4.1
@angular/platform-browser-dynamic: 2.4.1
@angular/router: 3.4.1
@angular/compiler-cli: 2.4.1

aralroca avatar Jan 19 '17 08:01 aralroca

Can reproduce it in the demo-app.

I think the problem is because the internal TooltipComponent has a _visibility property that changes state but the change detection does not recognize it because you skipped the sub component tree. So the animation does not get triggered and will show/hide the tooltip.

In my opinion even when change detection is onPush the tooltip should work fine. I will have a look on it maybe file a PR.

Maybe @jelbourn @kara @DevVersion do have an idea/opinion?

thomaspink avatar Jan 19 '17 18:01 thomaspink

One of our goals for exiting beta is that all of the components work with OnPush, so it's definitely something we want to address. PRs are always welcome!

jelbourn avatar Jan 19 '17 18:01 jelbourn

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.