mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Fix "menubar does not collapse when clicking on other menubar" + minor changes
This commit is contained in:
parent
e448cd0761
commit
d77185a5a1
@ -55,13 +55,13 @@
|
|||||||
.ui-menubar .ui-button { float: left; font-weight: normal; border-top-width: 0 !important; border-bottom-width: 0 !important; margin: 0; outline: none; }
|
.ui-menubar .ui-button { float: left; font-weight: normal; border-top-width: 0 !important; border-bottom-width: 0 !important; margin: 0; outline: none; }
|
||||||
.ui-menubar .ui-menubar-link { border-right: 1px dashed transparent; border-left: 1px dashed transparent; }
|
.ui-menubar .ui-menubar-link { border-right: 1px dashed transparent; border-left: 1px dashed transparent; }
|
||||||
|
|
||||||
ol.ui-menubar, ul.ui-menubar {
|
.ui-menubar, .ui-menubar {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
li.ui-menubar-item {
|
.ui-menubar-item {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,6 @@ $.widget("ui.menubar", {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
|
||||||
if (event.type == "click" && menu.is(":visible") && self.active && self.active[0] == menu[0]) {
|
if (event.type == "click" && menu.is(":visible") && self.active && self.active[0] == menu[0]) {
|
||||||
self._close();
|
self._close();
|
||||||
return;
|
return;
|
||||||
@ -111,10 +110,13 @@ $.widget("ui.menubar", {
|
|||||||
});
|
});
|
||||||
self._bind(document, {
|
self._bind(document, {
|
||||||
click: function(event) {
|
click: function(event) {
|
||||||
if (self.open && !$(event.target).closest(".ui-menubar").length) {
|
if (self.open) {
|
||||||
|
var menubar = $(event.target).closest(".ui-menubar");
|
||||||
|
if (!menubar.length || menubar.get(0) !== self.element.get(0)) {
|
||||||
self._close();
|
self._close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
self._bind({
|
self._bind({
|
||||||
keyup: function(event) {
|
keyup: function(event) {
|
||||||
@ -162,6 +164,8 @@ $.widget("ui.menubar", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_close: function() {
|
_close: function() {
|
||||||
|
if (!this.active || !this.active.length)
|
||||||
|
return;
|
||||||
this.active.menu("closeAll").hide().attr("aria-hidden", "true").attr("aria-expanded", "false");
|
this.active.menu("closeAll").hide().attr("aria-hidden", "true").attr("aria-expanded", "false");
|
||||||
this.active.prev().removeClass("ui-state-active").removeAttr("tabIndex");
|
this.active.prev().removeClass("ui-state-active").removeAttr("tabIndex");
|
||||||
this.active = null;
|
this.active = null;
|
||||||
|
1
ui/jquery.ui.menu.js
vendored
1
ui/jquery.ui.menu.js
vendored
@ -319,6 +319,7 @@ $.widget("ui.menu", {
|
|||||||
if (newItem && newItem.length) {
|
if (newItem && newItem.length) {
|
||||||
this._open(newItem.parent());
|
this._open(newItem.parent());
|
||||||
var current = this.active;
|
var current = this.active;
|
||||||
|
//timeout so Firefox will not hide activedescendant change in expanding submenu from AT
|
||||||
setTimeout(function(){self.focus(event, newItem)}, 20);
|
setTimeout(function(){self.focus(event, newItem)}, 20);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user