From e3fd462a154e46675188e894527f69f5403d88c7 Mon Sep 17 00:00:00 2001 From: Colin Patrick Mccabe Date: Tue, 7 Jul 2015 14:02:22 -0700 Subject: [PATCH] HTRACE-203: htrace-gui: pressing enter should dismiss the modal dialog box (cmccabe) --- htrace-webapp/src/main/web/app/modal.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htrace-webapp/src/main/web/app/modal.js b/htrace-webapp/src/main/web/app/modal.js index 91d55fe..aed3fdc 100644 --- a/htrace-webapp/src/main/web/app/modal.js +++ b/htrace-webapp/src/main/web/app/modal.js @@ -30,5 +30,13 @@ htrace.showModalWarning = function(title, body) { htrace.showModal = function(html) { var el = $("#modal"); el.html(html); + // Dismiss the modal dialog box when enter is pressed. + $(document).on("keypress", function(e) { + if (e.which === 13) { + $(document).off('keypress'); + $('#modal button:first', $(this)).click(); + return false; + } + }); el.modal(); -} +}; -- 2.4.4