diff options
author | Hans Hillen <hans.hillen@gmail.com> | 2011-04-18 23:05:50 +0200 |
---|---|---|
committer | Hans Hillen <hans.hillen@gmail.com> | 2011-04-18 23:05:50 +0200 |
commit | d77185a5a115174cf6ab8bf5224f652124008e19 (patch) | |
tree | f3794aa9d6ef7c05f83d799193f6934e23b996b6 /tests/visual/menu/menubar.js | |
parent | e448cd076153500f178878abfa7db7631d452ad8 (diff) | |
download | jquery-ui-d77185a5a115174cf6ab8bf5224f652124008e19.tar.gz jquery-ui-d77185a5a115174cf6ab8bf5224f652124008e19.zip |
Fix "menubar does not collapse when clicking on other menubar" + minor changes
Diffstat (limited to 'tests/visual/menu/menubar.js')
-rw-r--r-- | tests/visual/menu/menubar.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/visual/menu/menubar.js b/tests/visual/menu/menubar.js index 453f5fae7..e6f6ab069 100644 --- a/tests/visual/menu/menubar.js +++ b/tests/visual/menu/menubar.js @@ -67,7 +67,6 @@ $.widget("ui.menubar", { return; } event.preventDefault(); - event.stopPropagation(); if (event.type == "click" && menu.is(":visible") && self.active && self.active[0] == menu[0]) { self._close(); return; @@ -111,8 +110,11 @@ $.widget("ui.menubar", { }); self._bind(document, { click: function(event) { - if (self.open && !$(event.target).closest(".ui-menubar").length) { - self._close(); + if (self.open) { + var menubar = $(event.target).closest(".ui-menubar"); + if (!menubar.length || menubar.get(0) !== self.element.get(0)) { + self._close(); + } } } }) @@ -162,6 +164,8 @@ $.widget("ui.menubar", { }, _close: function() { + if (!this.active || !this.active.length) + return; this.active.menu("closeAll").hide().attr("aria-hidden", "true").attr("aria-expanded", "false"); this.active.prev().removeClass("ui-state-active").removeAttr("tabIndex"); this.active = null; |