mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Menu: Remove incorrect scroll check behavior from focus event handler
This commit is contained in:
parent
a79d09a905
commit
019dcc26e3
22
ui/jquery.ui.menu.js
vendored
22
ui/jquery.ui.menu.js
vendored
@ -101,25 +101,13 @@ $.widget( "ui.menu", {
|
|||||||
"mouseleave .ui-menu": "collapseAll",
|
"mouseleave .ui-menu": "collapseAll",
|
||||||
focus: function( event ) {
|
focus: function( event ) {
|
||||||
var menuTop,
|
var menuTop,
|
||||||
menu = this.element,
|
item,
|
||||||
// Default to focusing the first item
|
menu = this.element;
|
||||||
item = menu.children( ".ui-menu-item" ).eq( 0 );
|
|
||||||
|
|
||||||
// If there's already an active item, keep it active
|
// If there's already an active item, keep it active
|
||||||
if ( this.active ) {
|
// If not, activate the first item
|
||||||
item = this.active;
|
item = this.active || menu.children( ".ui-menu-item" ).eq( 0 );
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.focus( event, item );
|
this.focus( event, item );
|
||||||
},
|
},
|
||||||
blur: function( event ) {
|
blur: function( event ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user