diff --git a/src/app/components/dynamicdialog/dynamicdialog-config.ts b/src/app/components/dynamicdialog/dynamicdialog-config.ts index fd8b7938519..ee1e493cc42 100755 --- a/src/app/components/dynamicdialog/dynamicdialog-config.ts +++ b/src/app/components/dynamicdialog/dynamicdialog-config.ts @@ -123,6 +123,11 @@ export class DynamicDialogConfig { * @group Props */ minY?: number; + /** + * When enabled, first button receives focus on show. + * @group Props + */ + focusOnShow?: boolean; /** * Whether the dialog can be displayed full screen. * @group Props diff --git a/src/app/components/dynamicdialog/dynamicdialog.ts b/src/app/components/dynamicdialog/dynamicdialog.ts index 7ff8183541b..00728d65ae5 100755 --- a/src/app/components/dynamicdialog/dynamicdialog.ts +++ b/src/app/components/dynamicdialog/dynamicdialog.ts @@ -161,6 +161,10 @@ export class DynamicDialogComponent implements AfterViewInit, OnDestroy { return this.config.minY ? this.config.minY : 0; } + get focusOnShow(): boolean { + return this.config.focusOnShow ?? true; + } + get keepInViewport(): boolean { return this.config.keepInViewport!; } @@ -253,7 +257,9 @@ export class DynamicDialogComponent implements AfterViewInit, OnDestroy { if (this.config.modal !== false) { this.enableModality(); } - this.focus(); + if (this.focusOnShow) { + this.focus(); + } break; case 'void':