@@ -99,7 +99,7 @@ $.widget( "ui.menu", {
9999 "mouseleave .ui-menu" : "collapseAll" ,
100100 "focus" : function ( event ) {
101101 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 ) ;
103103 if ( this . _hasScroll ( ) && ! this . active ) {
104104 menu . children ( ) . each ( function ( ) {
105105 var currentItem = $ ( this ) ;
@@ -196,15 +196,17 @@ $.widget( "ui.menu", {
196196 event . preventDefault ( ) ;
197197 break ;
198198 case $ . ui . keyCode . RIGHT :
199- this . expand ( event ) ;
199+ ! this . active . is ( ".ui-state-disabled" ) && this . expand ( event ) ;
200200 event . preventDefault ( ) ;
201201 break ;
202202 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+ }
208210 }
209211 event . preventDefault ( ) ;
210212 break ;
@@ -442,7 +444,6 @@ $.widget( "ui.menu", {
442444 this . active
443445 . children ( ".ui-menu " )
444446 . children ( ".ui-menu-item" )
445- . not ( ".ui-state-disabled" )
446447 . first ( ) ;
447448
448449 if ( newItem && newItem . length ) {
@@ -478,12 +479,10 @@ $.widget( "ui.menu", {
478479 if ( direction === "first" || direction === "last" ) {
479480 next = this . active
480481 [ direction === "first" ? "prevAll" : "nextAll" ] ( ".ui-menu-item" )
481- . not ( ".ui-state-disabled" )
482482 . eq ( - 1 ) ;
483483 } else {
484484 next = this . active
485485 [ direction + "All" ] ( ".ui-menu-item" )
486- . not ( ".ui-state-disabled" )
487486 . eq ( 0 ) ;
488487 }
489488 }
@@ -492,9 +491,6 @@ $.widget( "ui.menu", {
492491 }
493492
494493 this . focus ( event , next ) ;
495- if ( next . is ( ".ui-state-disabled" ) ) {
496- this . _move ( direction , filter , event ) ;
497- }
498494 } ,
499495
500496 nextPage : function ( event ) {
@@ -509,14 +505,14 @@ $.widget( "ui.menu", {
509505 var base = this . active . offset ( ) . top ,
510506 height = this . element . height ( ) ,
511507 result ;
512- this . active . nextAll ( ".ui-menu-item" ) . not ( ".ui-state-disabled" ) . each ( function ( ) {
508+ this . active . nextAll ( ".ui-menu-item" ) . each ( function ( ) {
513509 result = $ ( this ) ;
514510 return $ ( this ) . offset ( ) . top - base - height < 0 ;
515511 } ) ;
516512
517513 this . focus ( event , result ) ;
518514 } 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" )
520516 [ ! this . active ? "first" : "last" ] ( ) ) ;
521517 }
522518 } ,
@@ -533,14 +529,14 @@ $.widget( "ui.menu", {
533529 var base = this . active . offset ( ) . top ,
534530 height = this . element . height ( ) ,
535531 result ;
536- this . active . prevAll ( ".ui-menu-item" ) . not ( ".ui-state-disabled" ) . each ( function ( ) {
532+ this . active . prevAll ( ".ui-menu-item" ) . each ( function ( ) {
537533 result = $ ( this ) ;
538534 return $ ( this ) . offset ( ) . top - base + height > 0 ;
539535 } ) ;
540536
541537 this . focus ( event , result ) ;
542538 } 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 ( ) ) ;
544540 }
545541 } ,
546542
0 commit comments