Skip to content
Permalink
Browse files

Menu: Open submenu on click of parent item and only close menu when c…

…licking item without submenu.
  • Loading branch information...
kborchers committed Jul 31, 2012
1 parent b68b116 commit 7e1cb95d379c95ec412dccf6bc1b4e75dd203951
Showing with 8 additions and 3 deletions.
  1. +8 −3 ui/jquery.ui.menu.js
@@ -77,8 +77,11 @@ $.widget( "ui.menu", {
mouseHandled = true;

this.select( event );
// Redirect focus to the menu
if ( !this.element.is(":focus") ) {
// Open submenu on click
if ( this.element.has( ".ui-menu" ).length ) {
this.expand( event );
} else if ( !this.element.is(":focus") ) {
// Redirect focus to the menu
this.element.focus();
}
}
@@ -584,7 +587,9 @@ $.widget( "ui.menu", {
// Selecting a menu item removes the active item causing multiple clicks to be missing an item
item: this.active || $( event.target ).closest( ".ui-menu-item" )
};
this.collapseAll( event, true );
if ( !ui.item.has( ".ui-menu" ).length ) {
this.collapseAll( event, true );
}
this._trigger( "select", event, ui );
}
});

0 comments on commit 7e1cb95

Please sign in to comment.
You can’t perform that action at this time.