Ticket #36018: 36018.1.diff
File 36018.1.diff, 2.2 KB (added by , 9 years ago) |
---|
-
src/wp-admin/js/customize-controls.js
diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js index 67c78ed..e66dab5 100644
3468 3468 }); 3469 3469 3470 3470 // Focus the autofocused element 3471 _.each( [ 'panel', 'section', 'control' ], function ( type ) { 3472 var instance, id = api.settings.autofocus[ type ]; 3473 if ( id && api[ type ]( id ) ) { 3474 instance = api[ type ]( id ); 3475 // Wait until the element is embedded in the DOM 3476 instance.deferred.embedded.done( function () { 3477 // Wait until the preview has activated and so active panels, sections, controls have been set 3478 api.previewer.deferred.active.done( function () { 3471 _.each( [ 'panel', 'section', 'control' ], function( type ) { 3472 var id = api.settings.autofocus[ type ]; 3473 if ( ! id ) { 3474 return; 3475 } 3476 3477 /* 3478 * Defer focus until: 3479 * 1. The panel, section, or control exists (especially for dynamically-created ones). 3480 * 2. The instance is embedded in the document (and so is focusable). 3481 * 3. The preview has finished loading so that the active states have been set. 3482 */ 3483 api[ type ]( id, function( instance ) { 3484 instance.deferred.embedded.done( function() { 3485 api.previewer.deferred.active.done( function() { 3479 3486 instance.focus(); 3480 3487 }); 3481 3488 }); 3482 } 3489 }); 3483 3490 }); 3484 3491 3485 3492 /** -
src/wp-includes/class-wp-customize-manager.php
diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php index 10d7f3a..51d7c26 100644
final class WP_Customize_Manager { 1755 1755 1756 1756 // Pass to front end the Customizer construct being deeplinked. 1757 1757 foreach ( $this->get_autofocus() as $type => $id ) { 1758 $can_autofocus = ( 1759 ( 'control' === $type && $this->get_control( $id ) && $this->get_control( $id )->check_capabilities() ) 1760 || 1761 ( 'section' === $type && isset( $settings['sections'][ $id ] ) ) 1762 || 1763 ( 'panel' === $type && isset( $settings['panels'][ $id ] ) ) 1764 ); 1765 if ( $can_autofocus ) { 1766 $settings['autofocus'][ $type ] = $id; 1767 } 1758 $settings['autofocus'][ $type ] = $id; 1768 1759 } 1769 1760 1770 1761 ?>