Make WordPress Core

Changeset 31428 for trunk


Ignore:
Timestamp:
02/11/2015 11:31:20 PM (12 years ago)
Author:
ocean90
Message:

Customizer: Don't focus new widgets if they are added programmatically.

props westonruter.
fixes #31295.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/customize-widgets.js

    r31419 r31428  
    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 ) {
     
    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();
     
    18451848                        controlContainer.slideDown( function() {
    18461849                                if ( isExistingWidget ) {
    1847                                         widgetFormControl.expand();
    18481850                                        widgetFormControl.updateWidget( {
    18491851                                                instance: widgetFormControl.setting(),
     
    18521854                                                                throw error;
    18531855                                                        }
    1854                                                         widgetFormControl.focus();
    18551856                                                }
    18561857                                        } );
    1857                                 } else {
    1858                                         widgetFormControl.focus();
    18591858                                }
    18601859                        } );
Note: See TracChangeset for help on using the changeset viewer.