Skip to content

Commit cf0785c

Browse files
atscottmmalerba
authored andcommittedMay 7, 2024·
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. (cherry picked from commit 01540bb)
1 parent 23dc148 commit cf0785c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎src/material/tooltip/tooltip.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,10 @@ export class TooltipComponent implements OnDestroy {
10961096
const hideClass = this._hideAnimation;
10971097
tooltip.classList.remove(isVisible ? hideClass : showClass);
10981098
tooltip.classList.add(isVisible ? showClass : hideClass);
1099-
this._isVisible = isVisible;
1099+
if (this._isVisible !== isVisible) {
1100+
this._isVisible = isVisible;
1101+
this._changeDetectorRef.markForCheck();
1102+
}
11001103

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

0 commit comments

Comments
 (0)
Please sign in to comment.