Opened 9 years ago
Closed 9 years ago
#31295 closed defect (bug) (fixed)
Programmatically changing sidebars_widgets Customizer settings causes unexpected widget control focus
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.2 | Priority: | normal |
Severity: | normal | Version: | 4.1 |
Component: | Customize | Keywords: | has-patch |
Focuses: | javascript | Cc: |
Description
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
:
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 );
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
https://github.com/xwp/wordpress-develop/pull/70