From 5f215ec2c705287ac3b8cf0a8ec4f5de48f6efa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=87etin?= <92744169+mehmetcetin01140@users.noreply.github.com> Date: Tue, 3 Sep 2024 13:26:21 +0300 Subject: [PATCH] Fixed #16335 - DynamicDialog | Closing nested dialog makes the underlying dialog scroll back to the top --- src/app/components/dynamicdialog/dynamicdialog-config.ts | 5 +++++ src/app/components/dynamicdialog/dynamicdialog.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/components/dynamicdialog/dynamicdialog-config.ts b/src/app/components/dynamicdialog/dynamicdialog-config.ts index c71db273c6d..78108f6113f 100755 --- a/src/app/components/dynamicdialog/dynamicdialog-config.ts +++ b/src/app/components/dynamicdialog/dynamicdialog-config.ts @@ -45,6 +45,11 @@ export class DynamicDialogConfig { * @group Props */ focusOnShow?: boolean = true; + /** + * Specifies if autofocus should happen on close. + * @group Props + */ + focusOnClose?: boolean = true; /** * When enabled, can only focus on elements inside the dialog. * @group Props diff --git a/src/app/components/dynamicdialog/dynamicdialog.ts b/src/app/components/dynamicdialog/dynamicdialog.ts index c2b1b622dd8..4bda78bb479 100755 --- a/src/app/components/dynamicdialog/dynamicdialog.ts +++ b/src/app/components/dynamicdialog/dynamicdialog.ts @@ -383,7 +383,7 @@ export class DynamicDialogComponent implements AfterViewInit, OnDestroy { onAnimationEnd(event: AnimationEvent) { if (event.toState === 'void') { - if (this.parentContent) { + if (this.parentContent && this.config.focusOnClose !== false) { this.focus(this.parentContent); } this.onContainerDestroy();