diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index 47e546f9d3..ac761ef2bf 100644 --- a/src/wp-admin/js/customize-controls.js +++ b/src/wp-admin/js/customize-controls.js @@ -3693,8 +3693,6 @@ } ); } ); - control.notifications.container = control.getNotificationsContainerElement(); - renderNotificationsIfVisible = function() { var sectionId = control.section(); if ( ! sectionId || ( api.section.has( sectionId ) && api.section( sectionId ).expanded() ) ) { @@ -3905,7 +3903,7 @@ * @since 4.1.0 */ renderContent: function () { - var control = this, template, standardTypes, templateId; + var control = this, template, standardTypes, templateId, sectionId; standardTypes = [ 'button', @@ -3946,6 +3944,13 @@ control.container.html( template( control.params ) ); } } + + // Re-render notifications after content has been re-rendered. + control.notifications.container = control.getNotificationsContainerElement(); + sectionId = control.section(); + if ( ! sectionId || ( api.section.has( sectionId ) && api.section( sectionId ).expanded() ) ) { + control.notifications.render(); + } }, /** diff --git a/src/wp-includes/customize/class-wp-customize-media-control.php b/src/wp-includes/customize/class-wp-customize-media-control.php index db990cda69..33540c3fda 100644 --- a/src/wp-includes/customize/class-wp-customize-media-control.php +++ b/src/wp-includes/customize/class-wp-customize-media-control.php @@ -131,14 +131,18 @@ class WP_Customize_Media_Control extends WP_Customize_Control { */ public function content_template() { ?> - + <# + var selectButtonId = _.uniqueId( 'customize-media-control-button-' ); + var descriptionId = _.uniqueId( 'customize-media-control-description-' ); + var describedByAttr = data.description ? ' aria-describedby="' + descriptionId + '" ' : ''; + #> + <# if ( data.label ) { #> + + <# } #> +
+ <# if ( data.description ) { #> + {{{ data.description }}} + <# } #> <# if ( data.attachment && data.attachment.id ) { #>
@@ -178,7 +182,7 @@ class WP_Customize_Media_Control extends WP_Customize_Control {
<# if ( data.canUpload ) { #> - + <# } #>
@@ -192,7 +196,7 @@ class WP_Customize_Media_Control extends WP_Customize_Control { <# } #> <# if ( data.canUpload ) { #> - + <# } #>