Menu: Added focusing first menu item when menu receives focus and collapseAll when menu loses focus (blur).

This commit is contained in:
kborchers 2011-07-26 08:52:33 -05:00
parent f89091105f
commit e16e99a154

12
ui/jquery.ui.menu.js vendored
View File

@ -71,6 +71,18 @@ $.widget( "ui.menu", {
if ( target.length ) {
self.blur( event );
}
})
.bind( "focus.menu", function( event ) {
if ( self.options.disabled ) {
return;
}
self.focus( event, $( event.target ).children( ".ui-menu-item:first" ) );
})
.bind( "blur.menu", function( event ) {
if ( self.options.disabled ) {
return;
}
self.collapseAll( event );
});
this.refresh();