Make WordPress Core

Ticket #32839: 32839.2.patch

File 32839.2.patch, 1.7 KB (added by afercia, 10 years ago)
  • src/wp-admin/js/customize-nav-menus.js

     
    476476                        this.$search.val( '' );
    477477                },
    478478
    479                 // Add keyboard accessiblity to the panel
     479                // Add a few keyboard enhancements to the panel.
    480480                keyboardAccessible: function( event ) {
    481481                        var isEnter = ( 13 === event.which ),
    482482                                isEsc = ( 27 === event.which ),
    483                                 isDown = ( 40 === event.which ),
    484                                 isUp = ( 38 === event.which ),
    485483                                isBackTab = ( 9 === event.which && event.shiftKey ),
    486                                 selected = null,
    487                                 firstVisible = this.$el.find( '> .menu-item-tpl:visible:first' ),
    488                                 lastVisible = this.$el.find( '> .menu-item-tpl:visible:last' ),
    489484                                isSearchFocused = $( event.target ).is( this.$search );
    490485
    491                         if ( isDown || isUp ) {
    492                                 if ( isDown ) {
    493                                         if ( isSearchFocused ) {
    494                                                 selected = firstVisible;
    495                                         } else if ( this.selected && 0 !== this.selected.nextAll( '.menu-item-tpl:visible' ).length ) {
    496                                                 selected = this.selected.nextAll( '.menu-item-tpl:visible:first' );
    497                                         }
    498                                 } else if ( isUp ) {
    499                                         if ( isSearchFocused ) {
    500                                                 selected = lastVisible;
    501                                         } else if ( this.selected && 0 !== this.selected.prevAll( '.menu-item-tpl:visible' ).length ) {
    502                                                 selected = this.selected.prevAll( '.menu-item-tpl:visible:first' );
    503                                         }
    504                                 }
    505 
    506                                 this.select( selected );
    507 
    508                                 if ( selected ) {
    509                                         selected.focus();
    510                                 } else {
    511                                         this.$search.focus();
    512                                 }
    513 
    514                                 return;
    515                         }
    516 
    517486                        // If enter pressed but nothing entered, don't do anything
    518487                        if ( isEnter && ! this.$search.val() ) {
    519488                                return;