From 39ffaf0864ece2e6affb964408157680302979f0 Mon Sep 17 00:00:00 2001 From: urkerab Date: Wed, 9 Sep 2015 09:20:14 +0100 Subject: [PATCH] Close the popup when the Escape key is pressed --- js/client.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/client.js b/js/client.js index 9d97e1cca..567c5e61f 100644 --- a/js/client.js +++ b/js/client.js @@ -4,6 +4,14 @@ window.gui = require('nw.gui'); window.nwWindow = gui.Window.get(); } + $(document).on('keydown', function (e) { + if (e.keyCode == 27) { + e.preventDefault(); + e.stopPropagation(); + e.stopImmediatePropagation(); + app.closePopup(); + } + }); $(document).on('click', 'a', function (e) { if (this.className === 'closebutton') return; // handled elsewhere if (this.className.indexOf('minilogo') >= 0) return; // handled elsewhere