From: kborchers Date: Tue, 26 Jul 2011 13:52:33 +0000 (-0500) Subject: Menu: Added focusing first menu item when menu receives focus and collapseAll when... X-Git-Tag: 1.9m6~96^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F406%2Fhead;p=jquery-ui.git Menu: Added focusing first menu item when menu receives focus and collapseAll when menu loses focus (blur). --- diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index ad7a9c8c1..c55ae75c9 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -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();