[Tooltip] Change detection runs after showing tooltip
See original GitHub issueBug, feature request, or proposal:
Bug
What is the expected behavior?
Hovering an element with a matTooltip
should not trigger change detection on this element if it is an OnPush
element and its @Input()
s does not change.
What is the current behavior?
Hovering an element with a matTooltip
triggers change detection on this element.
This only happens if matTooltip
is defined using [matTooltip]="..."
and not when it is defined using matTooltip="..."
What are the steps to reproduce?
See https://stackblitz.com/edit/angular-material2-issue-ocg9sj
- pass the mouse on the red
div
- you get logs everytime the function needed to draw the component are called
- you don’t get any log from
ngOnChanges
- I would expect that since the
@Input()
didn’t change, the component shouldn’t be redraw!
What is the use-case or motivation for changing an existing behavior?
Prevent useless redraws
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
cf stackblitz
Is there anything else we should know?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:74
- Comments:32 (1 by maintainers)
Top Results From Across the Web
Angular changeDetector.detectChanges() breaks matTooltip ...
The matTooltip in following component is redering correctly.
Read more >Change detection in Angular 101 - Sergey Gultyayev - Medium
This error is usually caused when you change some value that is bound to a template changed after the change detection. The most...
Read more >How to Create a Tooltip Directive in Angular | by Colin Broberg
Let's start at the top. The directive has a required input, the tooltip text itself, and an optional input to change the delay...
Read more >Create Views for Tooltips (Viz in Tooltip) - Tableau Help
You can show related vizzes in tooltips to help your audience engage with the data at a different or deeper level, while keeping...
Read more >Change Log - /tooltips - Kendo UI for Angular - Telerik
Bug Fixes · remove extra tooltip shadow in Material theme (#38) · calling show multiple times shows multiple tooltips · tooltip visible after...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, I’m having this issue too with matTooltip directive. The component’s changeDetection is set to ChangeDetectionStrategy.OnPush. On hover / leave, the component’s change detection is triggered multiple times.
Thx !
I agree, this is a problem for bigger applications with slow change detection cycle. It brings us a lot of problems 😦