From 2e38e0453510e198f66202c0f3e887296e5b06cc Mon Sep 17 00:00:00 2001 From: jzaefferer Date: Thu, 17 Mar 2011 12:00:37 +0100 Subject: [PATCH] Menubar: Handle ESCAPE to close and refactor document-click code to also use _bind --- tests/visual/menu/menubar.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/visual/menu/menubar.js b/tests/visual/menu/menubar.js index 63fc34e84..323f6f681 100644 --- a/tests/visual/menu/menubar.js +++ b/tests/visual/menu/menubar.js @@ -75,8 +75,17 @@ $.widget("ui.menubar", { }; }); - $(document).click(function(event) { - !$(event.target).closest(".ui-menubar").length && self._close(); + self._bind(document, { + click: function(event) { + !$(event.target).closest(".ui-menubar").length && self._close(); + } + }) + self._bind({ + keyup: function(event) { + if (event.keyCode == $.ui.keyCode.ESCAPE) { + self._close(); + } + } }); }, -- 2.39.5