mirror of
https://github.com/jquery/jquery-ui.git
synced 2026-04-20 03:02:41 -04:00
Menu: Added focusing first menu item when menu receives focus and collapseAll when menu loses focus (blur).
This commit is contained in:
12
ui/jquery.ui.menu.js
vendored
12
ui/jquery.ui.menu.js
vendored
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user