diff --git a/alfa-client/libs/design-system/src/lib/icons/accessibility-icon/accessibility-icon.component.ts b/alfa-client/libs/design-system/src/lib/icons/accessibility-icon/accessibility-icon.component.ts index 04a9f704dac2d4a0c93dd9a8794376f21dfa7b65..a8c309a368e22aeb3f5d031287781f1107b234c2 100644 --- a/alfa-client/libs/design-system/src/lib/icons/accessibility-icon/accessibility-icon.component.ts +++ b/alfa-client/libs/design-system/src/lib/icons/accessibility-icon/accessibility-icon.component.ts @@ -11,6 +11,7 @@ import { iconVariants, IconVariants } from '../iconVariants'; viewBox="0 0 26 26" [ngClass]="[twMerge(iconVariants({ size }), 'fill-neutral-500 dark:fill-neutral-400', class)]" xmlns="http://www.w3.org/2000/svg" + aria-hidden="true" > <rect x="2" y="2" width="22" height="22" rx="11" /> <path diff --git a/alfa-client/libs/design-system/src/lib/tooltip/tooltip.directive.spec.ts b/alfa-client/libs/design-system/src/lib/tooltip/tooltip.directive.spec.ts index e39f39af4d4342b92c643cb8156c7c49ed77fcd2..0ada2b5b0fa9611d30710bcb7884cd5b3fa59692 100644 --- a/alfa-client/libs/design-system/src/lib/tooltip/tooltip.directive.spec.ts +++ b/alfa-client/libs/design-system/src/lib/tooltip/tooltip.directive.spec.ts @@ -61,6 +61,16 @@ describe('TooltipDirective', () => { expect(directive).toBeTruthy(); }); + describe('ngAfterViewInit', () => { + it('should create tooltip', () => { + directive.createTooltip = jest.fn(); + + directive.ngAfterViewInit(); + + expect(directive.createTooltip).toHaveBeenCalled(); + }); + }); + describe('ngOnDestroy', () => { it('should destroy tooltip', () => { directive.destroy = jest.fn(); 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 09d7958f93cd817c6cc8fba64f329e9684902c1c..d94abe415abd835cff2f6a596d599a409d6e575e 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 @@ -24,6 +24,7 @@ import { isEscapeKey, isNotNull } from '@alfa-client/tech-shared'; import { InteractivityChecker } from '@angular/cdk/a11y'; import { + AfterViewInit, ComponentRef, Directive, ElementRef, @@ -31,7 +32,6 @@ import { inject, Input, OnDestroy, - OnInit, Renderer2, ViewContainerRef, } from '@angular/core'; @@ -44,7 +44,7 @@ const OUTLINE_INDENT = 4; // Outline offset (2) + outline width (2) selector: '[tooltip]', standalone: true, }) -export class TooltipDirective implements OnInit, OnDestroy { +export class TooltipDirective implements AfterViewInit, OnDestroy { @Input() tooltip: string = ''; componentRef: ComponentRef<TooltipComponent> = null; @@ -56,7 +56,7 @@ export class TooltipDirective implements OnInit, OnDestroy { public renderer: Renderer2 = inject(Renderer2); public interactivityChecker: InteractivityChecker = inject(InteractivityChecker); - ngOnInit(): void { + ngAfterViewInit(): void { this.createTooltip(); }