Ticket #32839: 32839.patch
File 32839.patch, 1.7 KB (added by , 10 years ago) |
---|
-
src/wp-admin/js/customize-nav-menus.js
476 476 this.$search.val( '' ); 477 477 }, 478 478 479 // Add keyboard accessiblity to the panel479 // Add a few keyboard enhancements to the panel. 480 480 keyboardAccessible: function( event ) { 481 481 var isEnter = ( 13 === event.which ), 482 482 isEsc = ( 27 === event.which ), 483 isDown = ( 40 === event.which ),484 isUp = ( 38 === event.which ),485 483 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' ),489 484 isSearchFocused = $( event.target ).is( this.$search ); 490 485 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 517 486 // If enter pressed but nothing entered, don't do anything 518 487 if ( isEnter && ! this.$search.val() ) { 488 console.log('doing nothing') 519 489 return; 520 490 } 521 491