aboutsummaryrefslogtreecommitdiffstats
path: root/tests/visual/menu/menubar.js
diff options
context:
space:
mode:
authorjzaefferer <joern.zaefferer@gmail.com>2011-03-17 15:26:06 +0100
committerjzaefferer <joern.zaefferer@gmail.com>2011-03-17 15:26:06 +0100
commit24d1952045f1020972ecfba2cf3beadeed05ce50 (patch)
tree8b1cc1cc527d1856993551e31e4b16579177f260 /tests/visual/menu/menubar.js
parent133137b39b87e21fd1f49e170fbcf0e7c76a442b (diff)
downloadjquery-ui-24d1952045f1020972ecfba2cf3beadeed05ce50.tar.gz
jquery-ui-24d1952045f1020972ecfba2cf3beadeed05ce50.zip
Menubar: Fix closing with escape key
Diffstat (limited to 'tests/visual/menu/menubar.js')
-rw-r--r--tests/visual/menu/menubar.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/visual/menu/menubar.js b/tests/visual/menu/menubar.js
index 19e9ed630..35d0cc24f 100644
--- a/tests/visual/menu/menubar.js
+++ b/tests/visual/menu/menubar.js
@@ -50,13 +50,17 @@ $.widget("ui.menubar", {
menu = input.next("ul");
input.bind("click focus mouseenter", function(event) {
+ // ignore triggered focus event
+ if (event.type == "focus" && !event.originalEvent) {
+ return;
+ }
event.preventDefault();
event.stopPropagation();
if (menu.is(":visible") && self.active && self.active[0] == menu[0]) {
self._close();
return;
}
- if (menu.length && (self.open || event.type == "click")) {
+ if (self.open || event.type == "click") {
self._open(event, menu);
}
})
@@ -98,11 +102,11 @@ $.widget("ui.menubar", {
})
self._bind({
keyup: function(event) {
- if (event.keyCode == $.ui.keyCode.ESCAPE) {
+ if (event.keyCode == $.ui.keyCode.ESCAPE && self.open) {
if (self.active.menu("left", event) !== true) {
- self._close( event );
- // bypass the focus event handler above
- self.active.prev()[0].focus();
+ var active = self.active;
+ self.active.blur();
+ active.prev().focus();
}
}
}