]> source.dussan.org Git - jquery-ui.git/commitdiff
Menu: Remove incorrect scroll check behavior from focus event handler
authorkborchers <kris.borchers@gmail.com>
Tue, 10 Jul 2012 04:20:43 +0000 (23:20 -0500)
committerkborchers <kris.borchers@gmail.com>
Tue, 10 Jul 2012 05:14:53 +0000 (00:14 -0500)
ui/jquery.ui.menu.js

index 127a09bb51c2bc8d73c4abedb88ffea73bade5d2..3658bd8d566acd288f760e8349cd6648e36b76fc 100644 (file)
@@ -101,25 +101,13 @@ $.widget( "ui.menu", {
                        "mouseleave .ui-menu": "collapseAll",
                        focus: function( event ) {
                                var menuTop,
-                                       menu = this.element,
-                                       // Default to focusing the first item
-                                       item = menu.children( ".ui-menu-item" ).eq( 0 );
+                                       item,
+                                       menu = this.element;
 
                                // If there's already an active item, keep it active
-                               if ( this.active ) {
-                                       item = this.active;
-                               // If there's no active item and the menu is scrolled,
-                               // then find the first visible item
-                               } else if ( this._hasScroll() ) {
-                                       menuTop = menu.offset().top;
-                                       menu.children().each(function() {
-                                               var currentItem = $( this );
-                                               if ( currentItem.offset().top - menuTop >= 0 ) {
-                                                       item = currentItem;
-                                                       return false;
-                                               }
-                                       });
-                               }
+                               // If not, activate the first item
+                               item = this.active || menu.children( ".ui-menu-item" ).eq( 0 );
+
                                this.focus( event, item );
                        },
                        blur: function( event ) {