From d394991044eae8cd253c66ef34c8df84e43260e1 Mon Sep 17 00:00:00 2001 From: Nick Krantz Date: Fri, 23 Jan 2026 13:38:25 -0600 Subject: [PATCH] allow exporting of the DialogComponent --- .../src/dialog/dialog/dialog.component.ts | 31 ++++++++++++------- libs/components/src/dialog/index.ts | 1 + 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/libs/components/src/dialog/dialog/dialog.component.ts b/libs/components/src/dialog/dialog/dialog.component.ts index f9073da2217..2ce19a9f9e0 100644 --- a/libs/components/src/dialog/dialog/dialog.component.ts +++ b/libs/components/src/dialog/dialog/dialog.component.ts @@ -145,6 +145,26 @@ export class DialogComponent implements AfterViewInit { }); ngAfterViewInit() { + this.focusOnHeader(); + } + + handleEsc(event: Event) { + if (!this.dialogRef?.disableClose) { + this.dialogRef?.close(); + event.stopPropagation(); + } + } + + onAnimationEnd() { + this.animationCompleted.set(true); + } + + /** + * Moves focus to the dialog header element. + * This is done automatically when the dialog is opened but can be called manually + * when the contents of the dialog change and focus should be reset. + */ + focusOnHeader(): void { /** * Wait a tick for any focus management to occur on the trigger element before moving focus to * the dialog header. We choose the dialog header because it is always present, unlike possible @@ -159,15 +179,4 @@ export class DialogComponent implements AfterViewInit { this.destroyRef.onDestroy(() => clearTimeout(headerFocusTimeout)); } - - handleEsc(event: Event) { - if (!this.dialogRef?.disableClose) { - this.dialogRef?.close(); - event.stopPropagation(); - } - } - - onAnimationEnd() { - this.animationCompleted.set(true); - } } diff --git a/libs/components/src/dialog/index.ts b/libs/components/src/dialog/index.ts index fb4c2721b81..ce41f7957f6 100644 --- a/libs/components/src/dialog/index.ts +++ b/libs/components/src/dialog/index.ts @@ -2,3 +2,4 @@ export * from "./dialog.module"; export * from "./simple-dialog/types"; export * from "./dialog.service"; export { DIALOG_DATA } from "@angular/cdk/dialog"; +export { DialogComponent } from "./dialog/dialog.component";