Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/js/_enqueues/wp/customize/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -4726,10 +4726,19 @@
* @param {Object} attachment
*/
setImageFromAttachment: function( attachment ) {
var control = this;
this.params.attachment = attachment;

// Set the Customizer setting; the callback takes care of rendering.
this.setting( attachment.id );

// Set focus to the first relevant button after the icon.
_.defer( function() {
var firstButton = control.container.find( '.actions .button' ).first();
if ( firstButton.length ) {
firstButton.focus();
}
} );
}
});

Expand Down Expand Up @@ -4812,7 +4821,8 @@
* @param {Object} attachment
*/
setImageFromAttachment: function( attachment ) {
var sizes = [ 'site_icon-32', 'thumbnail', 'full' ], link,
var control = this,
sizes = [ 'site_icon-32', 'thumbnail', 'full' ], link,
icon;

_.each( sizes, function( size ) {
Expand All @@ -4833,6 +4843,14 @@
// Update the icon in-browser.
link = $( 'link[rel="icon"][sizes="32x32"]' );
link.attr( 'href', icon.url );

// Set focus to the first relevant button after the icon.
_.defer( function() {
var firstButton = control.container.find( '.actions .button' ).first();
if ( firstButton.length ) {
firstButton.focus();
}
} );
},

/**
Expand Down
Loading