File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -437,6 +437,22 @@ define([
437437 target = $ ( event . target ) . closest ( '.ui-menu-item' ) ;
438438 target . get ( 0 ) . scrollIntoView ( ) ;
439439
440+ // Open submenu on click
441+ if ( target . has ( '.ui-menu' ) . length ) {
442+ this . expand ( event ) ;
443+ } else if ( ! this . element . is ( ':focus' ) &&
444+ $ ( this . document [ 0 ] . activeElement ) . closest ( '.ui-menu' ) . length
445+ ) {
446+ // Redirect focus to the menu
447+ this . element . trigger ( 'focus' , [ true ] ) ;
448+
449+ // If the active item is on the top level, let it stay active.
450+ // Otherwise, blur the active item since it is no longer visible.
451+ if ( this . active && this . active . parents ( '.ui-menu' ) . length === 1 ) { //eslint-disable-line
452+ clearTimeout ( this . timer ) ;
453+ }
454+ }
455+
440456 if ( ! target . hasClass ( 'level-top' ) || ! target . has ( '.ui-menu' ) . length ) {
441457 window . location . href = target . find ( '> a' ) . attr ( 'href' ) ;
442458 }
You can’t perform that action at this time.
0 commit comments