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

props westonruter.
fixes #31295.
Built from https://develop.svn.wordpress.org/trunk@31428


git-svn-id: http://core.svn.wordpress.org/trunk@31409 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling
2015-02-11 23:32:27 +00:00
parent 4b66a66b20
commit 70ca74b37b
3 changed files with 7 additions and 8 deletions

View File

@@ -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();
}
} );

File diff suppressed because one or more lines are too long