Permalink
Browse files

Menu: Remove incorrect scroll check behavior from focus event handler

  • Loading branch information...
1 parent a79d09a commit 019dcc26e307614681a6dfd0fcd9665548cb6ab6 @kborchers kborchers committed Jul 10, 2012
Showing with 5 additions and 17 deletions.
  1. +5 −17 ui/jquery.ui.menu.js
View
@@ -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 ) {

0 comments on commit 019dcc2

Please sign in to comment.