1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-27 14:53:44 +00:00

allow exporting of the DialogComponent

This commit is contained in:
Nick Krantz
2026-01-23 13:38:25 -06:00
parent cf2427848e
commit d394991044
2 changed files with 21 additions and 11 deletions

View File

@@ -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);
}
}

View File

@@ -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";