Skip to content

Commit

Permalink
chore: close Hint and Dropdown when host is detached from dom (#7608
Browse files Browse the repository at this point in the history
)
  • Loading branch information
vladimirpotekhin authored Jun 3, 2024
1 parent 1bc1b76 commit f80cf05
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions projects/core/directives/hint/hint.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,7 @@ export class TuiHintComponent<C = any> {
takeUntil(destroy$),
)
.subscribe(([top, left]) => {
if (this.hover.el.nativeElement.isConnected) {
this.update(top, left);
} else {
this.hover.toggle(false);
}
this.update(top, left);
});

hovered$.pipe(takeUntil(destroy$)).subscribe(hover => this.hover.toggle(hover));
Expand All @@ -124,6 +120,12 @@ export class TuiHintComponent<C = any> {

@tuiPure
private update(top: number, left: number): void {
if (!this.hover.el.nativeElement.isConnected) {
this.hover.toggle(false);

return;
}

const {height, width} = this.el.nativeElement.getBoundingClientRect();
const {style} = this.el.nativeElement;
const rect = this.accessor.getClientRect();
Expand Down

0 comments on commit f80cf05

Please sign in to comment.