From 6f2222bc0b2f1f9e396a5138f10a6e1fe3f8c682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87etin?= <69278826+cetincakiroglu@users.noreply.github.com> Date: Fri, 10 May 2024 15:37:09 +0300 Subject: [PATCH] Refactor on https://github.com/primefaces/primeng/pull/15525 --- src/app/components/autofocus/autofocus.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/app/components/autofocus/autofocus.ts b/src/app/components/autofocus/autofocus.ts index 9b218a7cc84..45fc91426a0 100644 --- a/src/app/components/autofocus/autofocus.ts +++ b/src/app/components/autofocus/autofocus.ts @@ -35,20 +35,18 @@ export class AutoFocus { } if (!this.focused) { - if (this.autofocus) { - this.focus(); - } + this.autoFocus(); } } ngAfterViewChecked() { if (!this.focused) { - this.focus(); + this.autoFocus(); } } - focus() { - if (isPlatformBrowser(this.platformId)) { + autoFocus() { + if (isPlatformBrowser(this.platformId) && this.autofocus) { setTimeout(() => { const focusableElements = DomHandler.getFocusableElements(this.host?.nativeElement);