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();