]> source.dussan.org Git - jquery-ui.git/commitdiff
Menu: Added focusing first menu item when menu receives focus and collapseAll when... 406/head
authorkborchers <k_borchers@yahoo.com>
Tue, 26 Jul 2011 13:52:33 +0000 (08:52 -0500)
committerkborchers <k_borchers@yahoo.com>
Tue, 26 Jul 2011 13:52:33 +0000 (08:52 -0500)
ui/jquery.ui.menu.js

index ad7a9c8c1806f666851b58055eb1a858bef1ccfd..c55ae75c90385edc214ffeac8617953c65eb9fb1 100644 (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();