From 49e5e0dace8fc923ac1b2f808225891c8a3ac848 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 23 May 2019 12:54:21 -0400 Subject: [PATCH] LP1826584 Spacebar closes alert/cofirm dialogs (Angular) Angular alert and confirm dialogs may now be closed with the space bar in addition to the escape key. Note for confirm dialogs, space bar is the same as clicking the "OK/Continue" button. Includes Alert and Confirm dialog examples in the sandbox page for testing. Signed-off-by: Bill Erickson --- Open-ILS/src/eg2/src/app/share/dialog/alert.component.html | 1 + Open-ILS/src/eg2/src/app/share/dialog/alert.component.ts | 6 ++++++ .../src/eg2/src/app/share/dialog/confirm.component.html | 1 + Open-ILS/src/eg2/src/app/share/dialog/confirm.component.ts | 8 ++++++++ .../src/eg2/src/app/staff/sandbox/sandbox.component.html | 14 ++++++++++++++ 5 files changed, 30 insertions(+) diff --git a/Open-ILS/src/eg2/src/app/share/dialog/alert.component.html b/Open-ILS/src/eg2/src/app/share/dialog/alert.component.html index e81f697c6e..27d5b2966c 100644 --- a/Open-ILS/src/eg2/src/app/share/dialog/alert.component.html +++ b/Open-ILS/src/eg2/src/app/share/dialog/alert.component.html @@ -3,6 +3,7 @@
{{dialogBody}}
diff --git a/Open-ILS/src/eg2/src/app/share/dialog/alert.component.ts b/Open-ILS/src/eg2/src/app/share/dialog/alert.component.ts index a09e972541..356bb12830 100644 --- a/Open-ILS/src/eg2/src/app/share/dialog/alert.component.ts +++ b/Open-ILS/src/eg2/src/app/share/dialog/alert.component.ts @@ -13,6 +13,12 @@ export class AlertDialogComponent extends DialogComponent { // What are we warning the user with? @Input() public dialogBody: string; + + handleKeyPress(evt: KeyboardEvent) { + if (evt.key === ' ' || evt.key === 'Escape') { + this.close(); + } + } } diff --git a/Open-ILS/src/eg2/src/app/share/dialog/confirm.component.html b/Open-ILS/src/eg2/src/app/share/dialog/confirm.component.html index 21766cac09..8c6aa051ca 100644 --- a/Open-ILS/src/eg2/src/app/share/dialog/confirm.component.html +++ b/Open-ILS/src/eg2/src/app/share/dialog/confirm.component.html @@ -9,6 +9,7 @@ + +
+
+ + + +
+
+ + + +
+
+ -- 2.11.0