From e54db3c4eb087f0d768fa1cbe26fe4e5192285cf Mon Sep 17 00:00:00 2001 From: Dessa Simpson Date: Sun, 5 Jul 2020 20:41:42 -0700 Subject: [PATCH] Close modal with bg click or escape key --- public/main.js | 6 ++++++ views/main.eta | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/public/main.js b/public/main.js index e6c99ec..e2246f0 100644 --- a/public/main.js +++ b/public/main.js @@ -43,3 +43,9 @@ function closeAddRequestModal() { } updateTable(); + +document.addEventListener("keydown", function onEvent(event) { + if (event.key === "Escape") { + closeAddRequestModal(); + } +}); diff --git a/views/main.eta b/views/main.eta index 6a2bdfd..c21ca40 100644 --- a/views/main.eta +++ b/views/main.eta @@ -30,7 +30,7 @@ View requests in any state -
+

Add Request