From: jzaefferer Date: Thu, 17 Mar 2011 11:00:37 +0000 (+0100) Subject: Menubar: Handle ESCAPE to close and refactor document-click code to also use _bind X-Git-Tag: 1.9m5~210 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2e38e0453510e198f66202c0f3e887296e5b06cc;p=jquery-ui.git Menubar: Handle ESCAPE to close and refactor document-click code to also use _bind --- 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(); + } + } }); },