Skip to content

Commit 01540bb

Browse files
authored
fix(material/tooltip): Tooltip should mark for check when visibility 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.
1 parent 0188516 commit 01540bb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/material/tooltip/tooltip.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,10 @@ export class TooltipComponent implements OnDestroy {
11051105
const hideClass = this._hideAnimation;
11061106
tooltip.classList.remove(isVisible ? hideClass : showClass);
11071107
tooltip.classList.add(isVisible ? showClass : hideClass);
1108-
this._isVisible = isVisible;
1108+
if (this._isVisible !== isVisible) {
1109+
this._isVisible = isVisible;
1110+
this._changeDetectorRef.markForCheck();
1111+
}
11091112

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

0 commit comments

Comments
 (0)