[wp-trac] [WordPress Trac] #31295: Programmatically changing sidebars_widgets Customizer settings causes unexpected widget control focus
WordPress Trac
noreply at wordpress.org
Wed Feb 11 13:03:50 UTC 2015
#31295: Programmatically changing sidebars_widgets Customizer settings causes
unexpected widget control focus
--------------------------+-----------------
Reporter: westonruter | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.2
Component: Customize | Version: 4.1
Severity: normal | Keywords:
Focuses: javascript |
--------------------------+-----------------
Normally when adding a new widget to a sidebar in the Customizer, the
expected UI is for the newly-added widget to receive keyboard focus for
editing. However, this is currently happening regardless of whether or not
a `sidebars_widgets` setting was updated via this Add Widget UI
interaction, or if it was done programmatically. If, in the latter case, a
widget was added to a `sidebars_widgets[...]` setting, it is not expected
that this should cause the control to be focused. Any such focus should be
done programmatically instead.
To reproduce the issue, enter the following commands in the JS console
while in the Customizer with a populated `sidebar-1`:
{{{#!js
wp.customize.section( 'sidebar-widgets-sidebar-1' ).expand()
var widgetIds = wp.customize( 'sidebars_widgets[sidebar-1]' ).get().slice(
0 );
var firstWidgetId = widgetIds.shift();
wp.customize('sidebars_widgets[sidebar-1]').set( widgetIds );
var newWidgetIds = widgetIds.slice( 0 );
newWidgetIds.push( firstWidgetId );
wp.customize('sidebars_widgets[sidebar-1]').set( newWidgetIds );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31295>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list