From f78e66412bebc11c6564f331916f63fa12731b51 Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Mon, 2 Dec 2024 14:01:14 +0100 Subject: [PATCH] OZG-7047 Add white spaces --- .../src/lib/tooltip/tooltip.directive.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/alfa-client/libs/design-system/src/lib/tooltip/tooltip.directive.ts b/alfa-client/libs/design-system/src/lib/tooltip/tooltip.directive.ts index 75d6524111..f4ee72567d 100644 --- a/alfa-client/libs/design-system/src/lib/tooltip/tooltip.directive.ts +++ b/alfa-client/libs/design-system/src/lib/tooltip/tooltip.directive.ts @@ -39,7 +39,10 @@ export class TooltipDirective implements OnDestroy { @HostListener('mouseenter') @HostListener('focusin') createTooltip(): void { - if (isNotNull(this.componentRef)) return; + if (isNotNull(this.componentRef)) { + return; + } + const nativeElement: HTMLElement = this.elementRef.nativeElement; const attachedToFocused: boolean = nativeElement.contains(document.activeElement); this.componentRef = this.viewContainerRef.createComponent(TooltipComponent); @@ -63,7 +66,10 @@ export class TooltipDirective implements OnDestroy { } setTooltipProperties(attachedToFocused = false): void { - if (isNull(this.componentRef)) return; + if (isNull(this.componentRef)) { + return; + } + const { left, right, bottom } = this.elementRef.nativeElement.getBoundingClientRect(); this.componentRef.instance.left = (right + left) / 2; this.componentRef.instance.top = attachedToFocused ? bottom + OUTLINE_INDENT : bottom; @@ -88,7 +94,10 @@ export class TooltipDirective implements OnDestroy { } destroy(): void { - if (isNull(this.componentRef)) return; + if (isNull(this.componentRef)) { + return; + } + this.componentRef.destroy(); this.componentRef = null; this.removeAriaDescribedBy(); -- GitLab