@@ -482,7 +482,10 @@ var WidgetCustomizer = (function ($) {
482482widget_id : widget_id ,
483483widget_id_base : widget . get ( 'id_base' ) ,
484484type : customize_control_type ,
485- is_new : ! is_existing_widget
485+ is_new : ! is_existing_widget ,
486+ width : widget . get ( 'width' ) ,
487+ height : widget . get ( 'height' ) ,
488+ is_wide : widget . get ( 'is_wide' )
486489} ,
487490previewer : control . setting . previewer
488491} ) ;
@@ -511,27 +514,17 @@ var WidgetCustomizer = (function ($) {
511514control . setting ( sidebar_widgets ) ;
512515}
513516
514- var form_autofocus = function ( ) {
515- var first_inside_input = widget_form_control . container . find ( '.widget-inside :input:visible:first' ) ;
516- if ( first_inside_input . length ) {
517- first_inside_input . focus ( ) ;
518- } else {
519- widget_form_control . container . find ( '.widget-top .widget-action:first' ) . focus ( ) ;
520- }
521- } ;
522-
523517customize_control . slideDown ( function ( ) {
524- widget_form_control . expandForm ( ) ;
525-
526518if ( is_existing_widget ) {
519+ widget_form_control . expandForm ( ) ;
527520widget_form_control . updateWidget ( widget_form_control . setting ( ) , function ( error ) {
528521if ( error ) {
529522throw error ;
530523}
531- form_autofocus ( ) ;
524+ widget_form_control . focus ( ) ;
532525} ) ;
533526} else {
534- form_autofocus ( ) ;
527+ widget_form_control . focus ( ) ;
535528}
536529} ) ;
537530
@@ -862,7 +855,7 @@ var WidgetCustomizer = (function ($) {
862855var control = this ;
863856control . expandControlSection ( ) ;
864857control . expandForm ( ) ;
865- control . container . find ( ':focusable:first' ) . focus ( ) ;
858+ control . container . find ( ':focusable:first' ) . focus ( ) . trigger ( 'click' ) ;
866859} ,
867860
868861/**
0 commit comments