diff options
author | kborchers <kris.borchers@gmail.com> | 2012-02-03 16:12:37 -0600 |
---|---|---|
committer | kborchers <kris.borchers@gmail.com> | 2012-02-03 16:12:37 -0600 |
commit | 48ad0994a0e517ac22c4fccab0958b6668640d78 (patch) | |
tree | e546456183d1ef88679612c755024cd185c37ecb /ui/jquery.ui.menu.js | |
parent | 4259978d39c6c9d8ce292ad0839d0d42c45400f0 (diff) | |
download | jquery-ui-48ad0994a0e517ac22c4fccab0958b6668640d78.tar.gz jquery-ui-48ad0994a0e517ac22c4fccab0958b6668640d78.zip |
Menu: Prevent clicking on disabled menu items and remove unnecessary extra padding from disabled items.
Diffstat (limited to 'ui/jquery.ui.menu.js')
-rw-r--r-- | ui/jquery.ui.menu.js | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index ebfd5087c..3ebdeeee3 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -56,13 +56,17 @@ $.widget( "ui.menu", { }, "click .ui-menu-item:has(a)": function( event ) { event.stopImmediatePropagation(); - this.select( event ); - // Redirect focus to the menu with a delay for firefox - this._delay( function() { - if ( !this.element.is(":focus") ) { - this.element.focus(); - } - }, 20); + //Don't select disabled menu items + if ( !$( event.target ).closest( ".ui-menu-item" ).is( ".ui-state-disabled" ) ) { + console.log(event.target); + this.select( event ); + // Redirect focus to the menu with a delay for firefox + this._delay( function() { + if ( !this.element.is(":focus") ) { + this.element.focus(); + } + }, 20); + } }, "mouseover .ui-menu-item": function( event ) { event.stopImmediatePropagation(); |