diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
index 9f385a003b..e6270ee0e6 100644
|
|
|
|
| 5365 | 5365 | |
| 5366 | 5366 | // Focus on the control that is associated with the given setting. |
| 5367 | 5367 | api.previewer.bind( 'focus-control-for-setting', function( settingId ) { |
| 5368 | | var matchedControl; |
| | 5368 | var matchedControls = []; |
| 5369 | 5369 | api.control.each( function( control ) { |
| 5370 | 5370 | var settingIds = _.pluck( control.settings, 'id' ); |
| 5371 | 5371 | if ( -1 !== _.indexOf( settingIds, settingId ) ) { |
| 5372 | | matchedControl = control; |
| | 5372 | matchedControls.push( control ); |
| 5373 | 5373 | } |
| 5374 | 5374 | } ); |
| 5375 | 5375 | |
| 5376 | | if ( matchedControl ) { |
| 5377 | | matchedControl.focus(); |
| | 5376 | // Focus on the matched control with the lowest priority (appearing higher). |
| | 5377 | if ( matchedControls.length ) { |
| | 5378 | matchedControls.sort( function( a, b ) { |
| | 5379 | return a.priority() - b.priority(); |
| | 5380 | } ); |
| | 5381 | matchedControls[0].focus(); |
| 5378 | 5382 | } |
| 5379 | 5383 | } ); |
| 5380 | 5384 | |
diff --git src/wp-includes/js/customize-selective-refresh.js src/wp-includes/js/customize-selective-refresh.js
index 0735b237c8..d3b81db6d7 100644
|
|
|
wp.customize.selectiveRefresh = ( function( $, api ) { |
| 312 | 312 | * @since 4.5.0 |
| 313 | 313 | */ |
| 314 | 314 | showControl: function() { |
| 315 | | var partial = this, settingId = partial.params.primarySetting, menuSlug; |
| | 315 | var partial = this, settingId = partial.params.primarySetting; |
| 316 | 316 | if ( ! settingId ) { |
| 317 | 317 | settingId = _.first( partial.settings() ); |
| 318 | 318 | } |
| 319 | 319 | if ( partial.getType() === 'nav_menu' ) { |
| 320 | | menuSlug = partial.params.navMenuArgs.theme_location; |
| 321 | | if ( menuSlug ) { |
| 322 | | settingId = 'nav_menu_locations[' + menuSlug + ']'; |
| | 320 | if ( partial.params.navMenuArgs.theme_location ) { |
| | 321 | settingId = 'nav_menu_locations[' + partial.params.navMenuArgs.theme_location + ']'; |
| | 322 | } else if ( partial.params.navMenuArgs.menu ) { |
| | 323 | settingId = 'nav_menu[' + String( partial.params.navMenuArgs.menu ) + ']'; |
| 323 | 324 | } |
| 324 | 325 | } |
| 325 | 326 | api.preview.send( 'focus-control-for-setting', settingId ); |