Skip to content

Commit

Permalink
fix(material/tooltip): Tooltip should mark for check when visibility …
Browse files Browse the repository at this point in the history
…changes (#29000)

This commit fixes an error in the tooltip component where it updates
a value used in a host binding without calling `markForCheck`. This does
not currently throw an error because `checkNoChanges` is broken for
`OnPush` components. However, the error was surfaced when testing an
"exhaustive" check that will check _all_ views, regardless of their
dirty state. The issue also doesn't really produce a _visible_ problem
because it occurs when the tooltip is hidden so the fact that the zoom
never updates doesn't make a real difference.

(cherry picked from commit 01540bb)
  • Loading branch information
atscott authored and mmalerba committed May 7, 2024
1 parent 23dc148 commit cf0785c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/material/tooltip/tooltip.ts
Expand Up @@ -1096,7 +1096,10 @@ export class TooltipComponent implements OnDestroy {
const hideClass = this._hideAnimation;
tooltip.classList.remove(isVisible ? hideClass : showClass);
tooltip.classList.add(isVisible ? showClass : hideClass);
this._isVisible = isVisible;
if (this._isVisible !== isVisible) {
this._isVisible = isVisible;
this._changeDetectorRef.markForCheck();
}

// It's common for internal apps to disable animations using `* { animation: none !important }`
// which can break the opening sequence. Try to detect such cases and work around them.
Expand Down

0 comments on commit cf0785c

Please sign in to comment.