aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.menu.js
diff options
context:
space:
mode:
authorkborchers <kris.borchers@gmail.com>2012-07-31 00:00:07 -0500
committerkborchers <kris.borchers@gmail.com>2012-07-31 00:00:07 -0500
commit7e1cb95d379c95ec412dccf6bc1b4e75dd203951 (patch)
treec62df5bb38053aa15f08e8785d0638648444c111 /ui/jquery.ui.menu.js
parentb68b116adfd48378f1dd6d5b6f0d437a6e8e2d2e (diff)
downloadjquery-ui-7e1cb95d379c95ec412dccf6bc1b4e75dd203951.tar.gz
jquery-ui-7e1cb95d379c95ec412dccf6bc1b4e75dd203951.zip
Menu: Open submenu on click of parent item and only close menu when clicking item without submenu.
Diffstat (limited to 'ui/jquery.ui.menu.js')
-rw-r--r--ui/jquery.ui.menu.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index 75cfac40b..055b13319 100644
--- a/ui/jquery.ui.menu.js
+++ b/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 );
}
});