Skip to content

Commit 019dcc2

Browse files
committed
Menu: Remove incorrect scroll check behavior from focus event handler
1 parent a79d09a commit 019dcc2

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

ui/jquery.ui.menu.js

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -101,25 +101,13 @@ $.widget( "ui.menu", {
101101
"mouseleave .ui-menu": "collapseAll",
102102
focus: function( event ) {
103103
var menuTop,
104-
menu = this.element,
105-
// Default to focusing the first item
106-
item = menu.children( ".ui-menu-item" ).eq( 0 );
104+
item,
105+
menu = this.element;
107106

108107
// If there's already an active item, keep it active
109-
if ( this.active ) {
110-
item = this.active;
111-
// If there's no active item and the menu is scrolled,
112-
// then find the first visible item
113-
} else if ( this._hasScroll() ) {
114-
menuTop = menu.offset().top;
115-
menu.children().each(function() {
116-
var currentItem = $( this );
117-
if ( currentItem.offset().top - menuTop >= 0 ) {
118-
item = currentItem;
119-
return false;
120-
}
121-
});
122-
}
108+
// If not, activate the first item
109+
item = this.active || menu.children( ".ui-menu-item" ).eq( 0 );
110+
123111
this.focus( event, item );
124112
},
125113
blur: function( event ) {

0 commit comments

Comments
 (0)