From 6bc391c3d4259cff1dacfd9cd0a2c83fdca602e8 Mon Sep 17 00:00:00 2001 From: SkyZeroZx <73321943+SkyZeroZx@users.noreply.github.com> Date: Wed, 8 Oct 2025 21:51:35 -0500 Subject: [PATCH] refactor(docs-infra): replace @Input with signal input for ignoredElementsIds in ClickOutside directive (#64302) replace @Input with signal input for ignoredElementsIds in ClickOutside directive PR Close #64302 --- .../directives/click-outside/click-outside.directive.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/adev/shared-docs/directives/click-outside/click-outside.directive.ts b/adev/shared-docs/directives/click-outside/click-outside.directive.ts index 14fbcb889bc..b9486cba66e 100644 --- a/adev/shared-docs/directives/click-outside/click-outside.directive.ts +++ b/adev/shared-docs/directives/click-outside/click-outside.directive.ts @@ -7,7 +7,7 @@ */ import {DOCUMENT} from '@angular/common'; -import {Directive, ElementRef, Input, inject, output} from '@angular/core'; +import {Directive, ElementRef, inject, input, output} from '@angular/core'; @Directive({ selector: '[docsClickOutside]', @@ -16,8 +16,7 @@ import {Directive, ElementRef, Input, inject, output} from '@angular/core'; }, }) export class ClickOutside { - // TODO: Understand why replacing this @Input with a signal input breaks the tests - @Input('docsClickOutsideIgnore') public ignoredElementsIds: string[] = []; + readonly ignoredElementsIds = input([], {alias: 'docsClickOutsideIgnore'}); public readonly clickOutside = output({alias: 'docsClickOutside'}); private readonly document = inject(DOCUMENT); @@ -33,11 +32,11 @@ export class ClickOutside { } private wasClickedOnIgnoredElement(event: MouseEvent): boolean { - if (this.ignoredElementsIds.length === 0) { + if (this.ignoredElementsIds().length === 0) { return false; } - return this.ignoredElementsIds.some((elementId) => { + return this.ignoredElementsIds().some((elementId) => { const element = this.document.getElementById(elementId); const target = event.target as Node; const contains = element?.contains(target);