Skip to content

Commit

Permalink
Menu: Make check for click outside of menu a function which can be ov…
Browse files Browse the repository at this point in the history
…erridden. Fixes #8929 - Menu needs adjustement for use in Selectmenu
  • Loading branch information
kborchers committed Aug 12, 2013
1 parent 5aa106a commit cceb163
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ui/jquery.ui.menu.js
Expand Up @@ -130,7 +130,7 @@ $.widget( "ui.menu", {
// Clicks outside of a menu collapse any open menus // Clicks outside of a menu collapse any open menus
this._on( this.document, { this._on( this.document, {
click: function( event ) { click: function( event ) {
if ( !$( event.target ).closest( ".ui-menu" ).length ) { if ( this._closeOnDocumentClick( event ) ) {
this.collapseAll( event ); this.collapseAll( event );
} }


Expand Down Expand Up @@ -502,6 +502,10 @@ $.widget( "ui.menu", {
.removeClass( "ui-state-active" ); .removeClass( "ui-state-active" );
}, },


_closeOnDocumentClick: function( event ) {
return !$( event.target ).closest( ".ui-menu" ).length;
},

collapse: function( event ) { collapse: function( event ) {
var newItem = this.active && var newItem = this.active &&
this.active.parent().closest( ".ui-menu-item", this.element ); this.active.parent().closest( ".ui-menu-item", this.element );
Expand Down

0 comments on commit cceb163

Please sign in to comment.