Changeset 33070
- Timestamp:
- 07/03/2015 08:36:59 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/customize-nav-menus.js
r33030 r33070 478 478 }, 479 479 480 // Add keyboard accessiblity to the panel480 // Add a few keyboard enhancements to the panel. 481 481 keyboardAccessible: function( event ) { 482 482 var isEnter = ( 13 === event.which ), 483 483 isEsc = ( 27 === event.which ), 484 isDown = ( 40 === event.which ),485 isUp = ( 38 === event.which ),486 484 isBackTab = ( 9 === event.which && event.shiftKey ), 487 selected = null,488 firstVisible = this.$el.find( '> .menu-item-tpl:visible:first' ),489 lastVisible = this.$el.find( '> .menu-item-tpl:visible:last' ),490 485 isSearchFocused = $( event.target ).is( this.$search ); 491 492 if ( isDown || isUp ) {493 if ( isDown ) {494 if ( isSearchFocused ) {495 selected = firstVisible;496 } else if ( this.selected && 0 !== this.selected.nextAll( '.menu-item-tpl:visible' ).length ) {497 selected = this.selected.nextAll( '.menu-item-tpl:visible:first' );498 }499 } else if ( isUp ) {500 if ( isSearchFocused ) {501 selected = lastVisible;502 } else if ( this.selected && 0 !== this.selected.prevAll( '.menu-item-tpl:visible' ).length ) {503 selected = this.selected.prevAll( '.menu-item-tpl:visible:first' );504 }505 }506 507 this.select( selected );508 509 if ( selected ) {510 selected.focus();511 } else {512 this.$search.focus();513 }514 515 return;516 }517 486 518 487 // If enter pressed but nothing entered, don't do anything
Note: See TracChangeset
for help on using the changeset viewer.