From 35d35e191cb0cce50e0539e61caf429b7e6885a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=87etin?= <92744169+mehmetcetin01140@users.noreply.github.com> Date: Tue, 25 Jun 2024 12:04:38 +0300 Subject: [PATCH] Fixed #15894 - DynamicDialog | Dynamic Dialog Errors If No Focusable Element (Maximum call stack size exceeded) --- src/app/components/dynamicdialog/dynamicdialog.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app/components/dynamicdialog/dynamicdialog.ts b/src/app/components/dynamicdialog/dynamicdialog.ts index 378ab0c535c..2af67bda442 100755 --- a/src/app/components/dynamicdialog/dynamicdialog.ts +++ b/src/app/components/dynamicdialog/dynamicdialog.ts @@ -431,6 +431,12 @@ export class DynamicDialogComponent implements AfterViewInit, OnDestroy { } focus(focusParentElement = this.contentViewChild.nativeElement) { + const focusableElements = DomHandler.getFocusableElements(focusParentElement); + + if (!focusableElements.length) { + return; + } + let focusable = DomHandler.getFocusableElement(focusParentElement, '[autofocus]'); if (focusable) { this.zone.runOutsideAngular(() => {