Skip to content

Commit f57c1de

Browse files
committed
chore: add comment for manually running change detection
Signed-off-by: Akshat Patel <[email protected]>
1 parent cbbe2b6 commit f57c1de

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/tooltip/tooltip.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,10 @@ export class Tooltip extends PopoverContainer implements OnChanges, AfterContent
146146
// Ignore first change since content is not initialized
147147
if ((changes.autoAlign && !changes.autoAlign.firstChange)
148148
|| (changes.disabled && !changes.disabled.firstChange && !changes.disabled.currentValue)) {
149-
// Update view before getting popover content
149+
// On toggling `disabled`, we manually update view so querySelector can detect the popover content node
150+
// Otherwise, the position of the popover will be incorrect when autoAlign is enabled
150151
this.changeDetectorRef.detectChanges();
152+
151153
// Reset the inline styles
152154
this.popoverContentRef = this.elementRef.nativeElement.querySelector(".cds--popover-content");
153155
this.popoverContentRef.setAttribute("style", "");

0 commit comments

Comments
 (0)