@@ -99,7 +99,7 @@ $.widget( "ui.menu", {
99
99
"mouseleave .ui-menu" : "collapseAll" ,
100
100
"focus" : function ( event ) {
101
101
var menu = this . element ,
102
- firstItem = menu . children ( ".ui-menu-item" ) . not ( ".ui-state-disabled" ) . eq ( 0 ) ;
102
+ firstItem = menu . children ( ".ui-menu-item" ) . eq ( 0 ) ;
103
103
if ( this . _hasScroll ( ) && ! this . active ) {
104
104
menu . children ( ) . each ( function ( ) {
105
105
var currentItem = $ ( this ) ;
@@ -196,15 +196,17 @@ $.widget( "ui.menu", {
196
196
event . preventDefault ( ) ;
197
197
break ;
198
198
case $ . ui . keyCode . RIGHT :
199
- this . expand ( event ) ;
199
+ ! this . active . is ( ".ui-state-disabled" ) && this . expand ( event ) ;
200
200
event . preventDefault ( ) ;
201
201
break ;
202
202
case $ . ui . keyCode . ENTER :
203
- if ( this . active . children ( "a[aria-haspopup='true']" ) . length ) {
204
- this . expand ( event ) ;
205
- }
206
- else {
207
- this . select ( event ) ;
203
+ if ( ! this . active . is ( ".ui-state-disabled" ) ) {
204
+ if ( this . active . children ( "a[aria-haspopup='true']" ) . length ) {
205
+ this . expand ( event ) ;
206
+ }
207
+ else {
208
+ this . select ( event ) ;
209
+ }
208
210
}
209
211
event . preventDefault ( ) ;
210
212
break ;
@@ -442,7 +444,6 @@ $.widget( "ui.menu", {
442
444
this . active
443
445
. children ( ".ui-menu " )
444
446
. children ( ".ui-menu-item" )
445
- . not ( ".ui-state-disabled" )
446
447
. first ( ) ;
447
448
448
449
if ( newItem && newItem . length ) {
@@ -478,12 +479,10 @@ $.widget( "ui.menu", {
478
479
if ( direction === "first" || direction === "last" ) {
479
480
next = this . active
480
481
[ direction === "first" ? "prevAll" : "nextAll" ] ( ".ui-menu-item" )
481
- . not ( ".ui-state-disabled" )
482
482
. eq ( - 1 ) ;
483
483
} else {
484
484
next = this . active
485
485
[ direction + "All" ] ( ".ui-menu-item" )
486
- . not ( ".ui-state-disabled" )
487
486
. eq ( 0 ) ;
488
487
}
489
488
}
@@ -492,9 +491,6 @@ $.widget( "ui.menu", {
492
491
}
493
492
494
493
this . focus ( event , next ) ;
495
- if ( next . is ( ".ui-state-disabled" ) ) {
496
- this . _move ( direction , filter , event ) ;
497
- }
498
494
} ,
499
495
500
496
nextPage : function ( event ) {
@@ -509,14 +505,14 @@ $.widget( "ui.menu", {
509
505
var base = this . active . offset ( ) . top ,
510
506
height = this . element . height ( ) ,
511
507
result ;
512
- this . active . nextAll ( ".ui-menu-item" ) . not ( ".ui-state-disabled" ) . each ( function ( ) {
508
+ this . active . nextAll ( ".ui-menu-item" ) . each ( function ( ) {
513
509
result = $ ( this ) ;
514
510
return $ ( this ) . offset ( ) . top - base - height < 0 ;
515
511
} ) ;
516
512
517
513
this . focus ( event , result ) ;
518
514
} else {
519
- this . focus ( event , this . activeMenu . children ( ".ui-menu-item" ) . not ( ".ui-state-disabled" )
515
+ this . focus ( event , this . activeMenu . children ( ".ui-menu-item" )
520
516
[ ! this . active ? "first" : "last" ] ( ) ) ;
521
517
}
522
518
} ,
@@ -533,14 +529,14 @@ $.widget( "ui.menu", {
533
529
var base = this . active . offset ( ) . top ,
534
530
height = this . element . height ( ) ,
535
531
result ;
536
- this . active . prevAll ( ".ui-menu-item" ) . not ( ".ui-state-disabled" ) . each ( function ( ) {
532
+ this . active . prevAll ( ".ui-menu-item" ) . each ( function ( ) {
537
533
result = $ ( this ) ;
538
534
return $ ( this ) . offset ( ) . top - base + height > 0 ;
539
535
} ) ;
540
536
541
537
this . focus ( event , result ) ;
542
538
} else {
543
- this . focus ( event , this . activeMenu . children ( ".ui-menu-item" ) . not ( ".ui-state-disabled" ) . first ( ) ) ;
539
+ this . focus ( event , this . activeMenu . children ( ".ui-menu-item" ) . first ( ) ) ;
544
540
}
545
541
} ,
546
542
0 commit comments