Browse Source

HUE-5244 [assist] Close the context popover on esc

Johan Ahlen 8 years ago
parent
commit
02762ee
1 changed files with 12 additions and 0 deletions
  1. 12 0
      desktop/core/src/desktop/templates/sql_context_popover.mako

+ 12 - 0
desktop/core/src/desktop/templates/sql_context_popover.mako

@@ -1261,6 +1261,18 @@ from metadata.conf import has_navigator
           });
         }
 
+        var closeOnEsc = function (e) {
+          if (e.keyCode === 27) {
+            hidePopover();
+          }
+        };
+
+        $(document).on('keyup', closeOnEsc);
+
+        self.disposalFunctions.push(function () {
+          $(document).off('keyup', closeOnEsc);
+        });
+
         window.setTimeout(function() {
           $(document).on('click', hideOnClickOutside);
         }, 0);