Make WordPress Core

Ticket #28835: 28835_4.patch

File 28835_4.patch, 1.5 KB (added by sathishn, 11 years ago)

Fixed formatting of code in the patch

  • src/wp-admin/js/customize-widgets.js

    # This patch file was generated by NetBeans IDE
    # Following Index: paths are relative to: C:\xampp\htdocs\wordpress\trunk
    # This patch can be applied using context Tools: Patch action on respective folder.
    # It uses platform neutral UTF-8 encoding and \n newlines.
    # Above lines and this line are ignored by the patching process.
     
    316316                                isEsc = ( event.which === 27 ),
    317317                                isDown = ( event.which === 40 ),
    318318                                isUp = ( event.which === 38 ),
     319                                isTab = ( event.which === 9 ),
     320                                isShift = ( event.shiftKey ),
    319321                                selected = null,
    320322                                firstVisible = this.$el.find( '> .widget-tpl:visible:first' ),
    321323                                lastVisible = this.$el.find( '> .widget-tpl:visible:last' ),
     324                                isLastWidgetFocused =  $( event.target ).is( '.widget-tpl:visible:last' ),
    322325                                isSearchFocused = $( event.target ).is( this.$search );
    323326
    324327                        if ( isDown || isUp ) {
     
    357360                        } else if ( isEsc ) {
    358361                                this.close( { returnFocus: true } );
    359362                        }
     363                       
     364                        if ( isTab ) {
     365                                if( isShift ) {
     366                                        if ( isSearchFocused ) {
     367                                                $( '.control-section:has(.open) .add-new-widget' ).focus();
     368                                                event.preventDefault();
    360369                }
     370                                } else {
     371                                        if ( isLastWidgetFocused ) {
     372                                                $( '.control-section:has(.open) .add-new-widget' ).focus();
     373                                                event.preventDefault();
     374                                        }
     375                                }
     376                        }
     377                }
    361378        });
    362379
    363380        /**