mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Selectmenu: Override menu's _closeOnDocumentClick function to prevent collapseAll and manually fix focus state on open
This commit is contained in:
parent
ec61e54e6f
commit
5a24ee0485
13
ui/jquery.ui.selectmenu.js
vendored
13
ui/jquery.ui.selectmenu.js
vendored
@ -149,10 +149,13 @@ $.widget( "ui.selectmenu", {
|
|||||||
// adjust menu styles to dropdown
|
// adjust menu styles to dropdown
|
||||||
this.menu.addClass( "ui-corner-bottom" ).removeClass( "ui-corner-all" );
|
this.menu.addClass( "ui-corner-bottom" ).removeClass( "ui-corner-all" );
|
||||||
|
|
||||||
// Make sure focus stays on selected item
|
|
||||||
this.menuInstance.delay = 999999999;
|
|
||||||
// Unbind uneeded Menu events
|
// Unbind uneeded Menu events
|
||||||
this.menuInstance._off( this.menu, "mouseleave" );
|
this.menuInstance._off( this.menu, "mouseleave" );
|
||||||
|
|
||||||
|
// Cancel the menu's collapseAll on document click
|
||||||
|
this.menuInstance._closeOnDocumentClick = function() {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function() {
|
refresh: function() {
|
||||||
@ -185,9 +188,13 @@ $.widget( "ui.selectmenu", {
|
|||||||
if ( this.options.disabled ) {
|
if ( this.options.disabled ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Support: IE6-IE9 click doesn't trigger focus on the button
|
// Support: IE6-IE9 click doesn't trigger focus on the button
|
||||||
if ( !this.menuItems ) {
|
if ( !this.menuItems ) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
} else {
|
||||||
|
this.menu.find( ".ui-state-focus" ).removeClass( "ui-state-focus" );
|
||||||
|
this.menu.menu( "focus", null, this._getSelectedItem() );
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isOpen = true;
|
this.isOpen = true;
|
||||||
@ -198,7 +205,7 @@ $.widget( "ui.selectmenu", {
|
|||||||
|
|
||||||
this._trigger( "open", event );
|
this._trigger( "open", event );
|
||||||
},
|
},
|
||||||
|
|
||||||
_position: function() {
|
_position: function() {
|
||||||
this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
|
this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user