HTRACE-203. htrace-web: pressing enter should dismiss the modal dialog box (Colin Patrick McCabe via iwasakims)
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.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();
-}
+};