File tree Expand file tree Collapse file tree 1 file changed +5
-17
lines changed
Expand file tree Collapse file tree 1 file changed +5
-17
lines changed Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments