mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Menu: Make check for click outside of menu a function which can be overridden. Fixes #8929 - Menu needs adjustement for use in Selectmenu
(cherry picked from commit cceb163548
)
This commit is contained in:
parent
8f7e3428f0
commit
2a7896ec3e
6
ui/jquery.ui.menu.js
vendored
6
ui/jquery.ui.menu.js
vendored
@ -130,7 +130,7 @@ $.widget( "ui.menu", {
|
||||
// Clicks outside of a menu collapse any open menus
|
||||
this._on( this.document, {
|
||||
click: function( event ) {
|
||||
if ( !$( event.target ).closest( ".ui-menu" ).length ) {
|
||||
if ( this._closeOnDocumentClick( event ) ) {
|
||||
this.collapseAll( event );
|
||||
}
|
||||
|
||||
@ -497,6 +497,10 @@ $.widget( "ui.menu", {
|
||||
.removeClass( "ui-state-active" );
|
||||
},
|
||||
|
||||
_closeOnDocumentClick: function( event ) {
|
||||
return !$( event.target ).closest( ".ui-menu" ).length;
|
||||
},
|
||||
|
||||
collapse: function( event ) {
|
||||
var newItem = this.active &&
|
||||
this.active.parent().closest( ".ui-menu-item", this.element );
|
||||
|
Loading…
Reference in New Issue
Block a user