Make WordPress Core

Ticket #31295: 31295.diff

File 31295.diff, 1.1 KB (added by westonruter, 9 years ago)

https://github.com/xwp/wordpress-develop/pull/70

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

    diff --git src/wp-admin/js/customize-widgets.js src/wp-admin/js/customize-widgets.js
    index 46b4ba3..814c01d 100644
     
    250250
    251251                // Adds a selected widget to the sidebar
    252252                submit: function( widgetTpl ) {
    253                         var widgetId, widget;
     253                        var widgetId, widget, widgetFormControl;
    254254
    255255                        if ( ! widgetTpl ) {
    256256                                widgetTpl = this.selected;
     
    268268                                return;
    269269                        }
    270270
    271                         this.currentSidebarControl.addWidget( widget.get( 'id_base' ) );
     271                        widgetFormControl = this.currentSidebarControl.addWidget( widget.get( 'id_base' ) );
     272                        if ( widgetFormControl ) {
     273                                widgetFormControl.focus();
     274                        }
    272275
    273276                        this.close();
    274277                },
     
    18391842
    18401843                        controlContainer.slideDown( function() {
    18411844                                if ( isExistingWidget ) {
    1842                                         widgetFormControl.expand();
    18431845                                        widgetFormControl.updateWidget( {
    18441846                                                instance: widgetFormControl.setting(),
    18451847                                                complete: function( error ) {
    18461848                                                        if ( error ) {
    18471849                                                                throw error;
    18481850                                                        }
    1849                                                         widgetFormControl.focus();
    18501851                                                }
    18511852                                        } );
    1852                                 } else {
    1853                                         widgetFormControl.focus();
    18541853                                }
    18551854                        } );
    18561855