diff options
author | jzaefferer <joern.zaefferer@gmail.com> | 2011-03-17 12:00:37 +0100 |
---|---|---|
committer | jzaefferer <joern.zaefferer@gmail.com> | 2011-03-17 12:00:37 +0100 |
commit | 2e38e0453510e198f66202c0f3e887296e5b06cc (patch) | |
tree | 3b4a4a3d3fbc5d4b5f77ede3eb39f8f960e30ebc /tests/visual | |
parent | 0872aac982f572f626275a74d1e74ce73a11ed0d (diff) | |
download | jquery-ui-2e38e0453510e198f66202c0f3e887296e5b06cc.tar.gz jquery-ui-2e38e0453510e198f66202c0f3e887296e5b06cc.zip |
Menubar: Handle ESCAPE to close and refactor document-click code to also use _bind
Diffstat (limited to 'tests/visual')
-rw-r--r-- | tests/visual/menu/menubar.js | 13 |
1 files 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(); + } + } }); }, |