Customizer: Don't focus new widgets if they are added programmatically.
props westonruter. fixes #31295. git-svn-id: https://develop.svn.wordpress.org/trunk@31428 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a4eb4880b4
commit
ea44136764
|
@ -250,7 +250,7 @@
|
|||
|
||||
// Adds a selected widget to the sidebar
|
||||
submit: function( widgetTpl ) {
|
||||
var widgetId, widget;
|
||||
var widgetId, widget, widgetFormControl;
|
||||
|
||||
if ( ! widgetTpl ) {
|
||||
widgetTpl = this.selected;
|
||||
|
@ -268,7 +268,10 @@
|
|||
return;
|
||||
}
|
||||
|
||||
this.currentSidebarControl.addWidget( widget.get( 'id_base' ) );
|
||||
widgetFormControl = this.currentSidebarControl.addWidget( widget.get( 'id_base' ) );
|
||||
if ( widgetFormControl ) {
|
||||
widgetFormControl.focus();
|
||||
}
|
||||
|
||||
this.close();
|
||||
},
|
||||
|
@ -1844,18 +1847,14 @@
|
|||
|
||||
controlContainer.slideDown( function() {
|
||||
if ( isExistingWidget ) {
|
||||
widgetFormControl.expand();
|
||||
widgetFormControl.updateWidget( {
|
||||
instance: widgetFormControl.setting(),
|
||||
complete: function( error ) {
|
||||
if ( error ) {
|
||||
throw error;
|
||||
}
|
||||
widgetFormControl.focus();
|
||||
}
|
||||
} );
|
||||
} else {
|
||||
widgetFormControl.focus();
|
||||
}
|
||||
} );
|
||||
|
||||
|
|
Loading…
Reference in New Issue