wp/wp-includes/media-template.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
--- a/wp/wp-includes/media-template.php	Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-includes/media-template.php	Mon Oct 14 18:28:13 2019 +0200
@@ -15,16 +15,18 @@
  */
 function wp_underscore_audio_template() {
 	$audio_types = wp_get_audio_extensions();
-?>
+	?>
 <audio style="visibility: hidden"
 	controls
 	class="wp-audio-shortcode"
 	width="{{ _.isUndefined( data.model.width ) ? 400 : data.model.width }}"
 	preload="{{ _.isUndefined( data.model.preload ) ? 'none' : data.model.preload }}"
 	<#
-	<?php foreach ( array( 'autoplay', 'loop' ) as $attr ):
-	?>if ( ! _.isUndefined( data.model.<?php echo $attr ?> ) && data.model.<?php echo $attr ?> ) {
-		#> <?php echo $attr ?><#
+	<?php
+	foreach ( array( 'autoplay', 'loop' ) as $attr ) :
+		?>
+	if ( ! _.isUndefined( data.model.<?php echo $attr; ?> ) && data.model.<?php echo $attr; ?> ) {
+		#> <?php echo $attr; ?><#
 	}
 	<?php endforeach ?>#>
 >
@@ -32,13 +34,17 @@
 	<source src="{{ data.model.src }}" type="{{ wp.media.view.settings.embedMimes[ data.model.src.split('.').pop() ] }}" />
 	<# } #>
 
-	<?php foreach ( $audio_types as $type ):
-	?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) { #>
-	<source src="{{ data.model.<?php echo $type ?> }}" type="{{ wp.media.view.settings.embedMimes[ '<?php echo $type ?>' ] }}" />
+	<?php
+	foreach ( $audio_types as $type ) :
+		?>
+	<# if ( ! _.isEmpty( data.model.<?php echo $type; ?> ) ) { #>
+	<source src="{{ data.model.<?php echo $type; ?> }}" type="{{ wp.media.view.settings.embedMimes[ '<?php echo $type; ?>' ] }}" />
 	<# } #>
-	<?php endforeach;
-?></audio>
-<?php
+		<?php
+	endforeach;
+	?>
+</audio>
+	<?php
 }
 
 /**
@@ -49,7 +55,7 @@
  */
 function wp_underscore_video_template() {
 	$video_types = wp_get_video_extensions();
-?>
+	?>
 <#  var w_rule = '', classes = [],
 		w, h, settings = wp.media.view.settings,
 		isYouTube = isVimeo = false;
@@ -69,7 +75,7 @@
 		h = Math.ceil( ( data.model.height * w ) / data.model.width );
 	} else {
 		h = data.model.height;
- 	}
+	}
 
 	if ( w ) {
 		w_rule = 'width: ' + w + 'px; ';
@@ -90,21 +96,32 @@
 	<# if ( w ) { #>width="{{ w }}"<# } #>
 	<# if ( h ) { #>height="{{ h }}"<# } #>
 	<?php
-	$props = array( 'poster' => '', 'preload' => 'metadata' );
-	foreach ( $props as $key => $value ):
+	$props = array(
+		'poster'  => '',
+		'preload' => 'metadata',
+	);
+	foreach ( $props as $key => $value ) :
 		if ( empty( $value ) ) {
-		?><#
-		if ( ! _.isUndefined( data.model.<?php echo $key ?> ) && data.model.<?php echo $key ?> ) {
-			#> <?php echo $key ?>="{{ data.model.<?php echo $key ?> }}"<#
+			?>
+		<#
+		if ( ! _.isUndefined( data.model.<?php echo $key; ?> ) && data.model.<?php echo $key; ?> ) {
+			#> <?php echo $key; ?>="{{ data.model.<?php echo $key; ?> }}"<#
 		} #>
-		<?php } else {
-			echo $key ?>="{{ _.isUndefined( data.model.<?php echo $key ?> ) ? '<?php echo $value ?>' : data.model.<?php echo $key ?> }}"<?php
+			<?php
+		} else {
+			echo $key
+			?>
+			="{{ _.isUndefined( data.model.<?php echo $key; ?> ) ? '<?php echo $value; ?>' : data.model.<?php echo $key; ?> }}"
+			<?php
 		}
 	endforeach;
-	?><#
-	<?php foreach ( array( 'autoplay', 'loop' ) as $attr ):
-	?> if ( ! _.isUndefined( data.model.<?php echo $attr ?> ) && data.model.<?php echo $attr ?> ) {
-		#> <?php echo $attr ?><#
+	?>
+	<#
+	<?php
+	foreach ( array( 'autoplay', 'loop' ) as $attr ) :
+		?>
+	if ( ! _.isUndefined( data.model.<?php echo $attr; ?> ) && data.model.<?php echo $attr; ?> ) {
+		#> <?php echo $attr; ?><#
 	}
 	<?php endforeach ?>#>
 >
@@ -118,15 +135,17 @@
 		<# }
 	} #>
 
-	<?php foreach ( $video_types as $type ):
-	?><# if ( data.model.<?php echo $type ?> ) { #>
-	<source src="{{ data.model.<?php echo $type ?> }}" type="{{ settings.embedMimes[ '<?php echo $type ?>' ] }}" />
+	<?php
+	foreach ( $video_types as $type ) :
+		?>
+	<# if ( data.model.<?php echo $type; ?> ) { #>
+	<source src="{{ data.model.<?php echo $type; ?> }}" type="{{ settings.embedMimes[ '<?php echo $type; ?>' ] }}" />
 	<# } #>
 	<?php endforeach; ?>
 	{{{ data.model.content }}}
 </video>
 </div>
-<?php
+	<?php
 }
 
 /**
@@ -139,8 +158,21 @@
 function wp_print_media_templates() {
 	global $is_IE;
 	$class = 'media-modal wp-core-ui';
-	if ( $is_IE && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false )
+	if ( $is_IE && strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 7' ) !== false ) {
 		$class .= ' ie7';
+	}
+
+	$alt_text_description = sprintf(
+		/* translators: 1: link to tutorial, 2: additional link attributes, 3: accessibility text */
+		__( '<a href="%1$s" %2$s>Describe the purpose of the image%3$s</a>. Leave empty if the image is purely decorative.' ),
+		esc_url( 'https://www.w3.org/WAI/tutorials/images/decision-tree' ),
+		'target="_blank" rel="noopener noreferrer"',
+		sprintf(
+			'<span class="screen-reader-text"> %s</span>',
+			/* translators: accessibility text */
+			__( '(opens in a new tab)' )
+		)
+	);
 	?>
 	<!--[if lte IE 8]>
 	<style>
@@ -153,8 +185,8 @@
 	</style>
 	<![endif]-->
 	<script type="text/html" id="tmpl-media-frame">
+		<div class="media-frame-title" id="media-frame-title"></div>
 		<div class="media-frame-menu"></div>
-		<div class="media-frame-title"></div>
 		<div class="media-frame-router"></div>
 		<div class="media-frame-content"></div>
 		<div class="media-frame-toolbar"></div>
@@ -162,9 +194,11 @@
 	</script>
 
 	<script type="text/html" id="tmpl-media-modal">
-		<div tabindex="0" class="<?php echo $class; ?>">
-			<button type="button" class="media-modal-close"><span class="media-modal-icon"><span class="screen-reader-text"><?php _e( 'Close media panel' ); ?></span></span></button>
-			<div class="media-modal-content"></div>
+		<div tabindex="0" class="<?php echo $class; ?>" role="dialog" aria-modal="true" aria-labelledby="media-frame-title">
+			<# if ( data.hasCloseButton ) { #>
+				<button type="button" class="media-modal-close"><span class="media-modal-icon"><span class="screen-reader-text"><?php _e( 'Close dialog' ); ?></span></span></button>
+			<# } #>
+			<div class="media-modal-content" role="document"></div>
 		</div>
 		<div class="media-modal-backdrop"></div>
 	</script>
@@ -196,7 +230,8 @@
 			<h2 class="upload-instructions"><?php _e( 'Upload Limit Exceeded' ); ?></h2>
 			<?php
 			/** This action is documented in wp-admin/includes/media.php */
-			do_action( 'upload_ui_over_quota' ); ?>
+			do_action( 'upload_ui_over_quota' );
+			?>
 
 		<?php else : ?>
 			<div class="upload-ui">
@@ -229,9 +264,11 @@
 				}
 				?>
 
-				<p class="max-upload-size"><?php
+				<p class="max-upload-size">
+				<?php
 					printf( __( 'Maximum upload file size: %s.' ), esc_html( size_format( $max_upload_size ) ) );
-				?></p>
+				?>
+				</p>
 
 				<# if ( data.suggestedWidth && data.suggestedHeight ) { #>
 					<p class="suggested-dimensions">
@@ -244,17 +281,18 @@
 
 				<?php
 				/** This action is documented in wp-admin/includes/media.php */
-				do_action( 'post-upload-ui' ); ?>
+				do_action( 'post-upload-ui' );
+				?>
 			</div>
 		<?php endif; ?>
 		</div>
 	</script>
 
 	<script type="text/html" id="tmpl-media-library-view-switcher">
-		<a href="<?php echo esc_url( add_query_arg( 'mode', 'list', $_SERVER['REQUEST_URI'] ) ) ?>" class="view-list">
+		<a href="<?php echo esc_url( add_query_arg( 'mode', 'list', $_SERVER['REQUEST_URI'] ) ); ?>" class="view-list">
 			<span class="screen-reader-text"><?php _e( 'List View' ); ?></span>
 		</a>
-		<a href="<?php echo esc_url( add_query_arg( 'mode', 'grid', $_SERVER['REQUEST_URI'] ) ) ?>" class="view-grid current">
+		<a href="<?php echo esc_url( add_query_arg( 'mode', 'grid', $_SERVER['REQUEST_URI'] ) ); ?>" class="view-grid current">
 			<span class="screen-reader-text"><?php _e( 'Grid View' ); ?></span>
 		</a>
 	</script>
@@ -283,6 +321,7 @@
 		<div class="edit-media-header">
 			<button class="left dashicons <# if ( ! data.hasPrevious ) { #> disabled <# } #>"><span class="screen-reader-text"><?php _e( 'Edit previous media item' ); ?></span></button>
 			<button class="right dashicons <# if ( ! data.hasNext ) { #> disabled <# } #>"><span class="screen-reader-text"><?php _e( 'Edit next media item' ); ?></span></button>
+			<button type="button" class="media-modal-close"><span class="media-modal-icon"><span class="screen-reader-text"><?php _e( 'Close dialog' ); ?></span></span></button>
 		</div>
 		<div class="media-frame-title"></div>
 		<div class="media-frame-content"></div>
@@ -337,7 +376,7 @@
 		<div class="attachment-info">
 			<span class="settings-save-status">
 				<span class="spinner"></span>
-				<span class="saved"><?php esc_html_e('Saved.'); ?></span>
+				<span class="saved"><?php esc_html_e( 'Saved.' ); ?></span>
 			</span>
 			<div class="details">
 				<div class="filename"><strong><?php _e( 'File name:' ); ?></strong> {{ data.filename }}</div>
@@ -347,12 +386,20 @@
 				<div class="file-size"><strong><?php _e( 'File size:' ); ?></strong> {{ data.filesizeHumanReadable }}</div>
 				<# if ( 'image' === data.type && ! data.uploading ) { #>
 					<# if ( data.width && data.height ) { #>
-						<div class="dimensions"><strong><?php _e( 'Dimensions:' ); ?></strong> {{ data.width }} &times; {{ data.height }}</div>
+						<div class="dimensions"><strong><?php _e( 'Dimensions:' ); ?></strong>
+							<?php
+							/* translators: 1: a number of pixels wide, 2: a number of pixels tall. */
+							printf( __( '%1$s by %2$s pixels' ), '{{ data.width }}', '{{ data.height }}' );
+							?>
+						</div>
 					<# } #>
 				<# } #>
 
-				<# if ( data.fileLength ) { #>
-					<div class="file-length"><strong><?php _e( 'Length:' ); ?></strong> {{ data.fileLength }}</div>
+				<# if ( data.fileLength && data.fileLengthHumanReadable ) { #>
+					<div class="file-length"><strong><?php _e( 'Length:' ); ?></strong>
+						<span aria-hidden="true">{{ data.fileLength }}</span>
+						<span class="screen-reader-text">{{ data.fileLengthHumanReadable }}</span>
+					</div>
 				<# } #>
 
 				<# if ( 'audio' === data.type && data.meta.bitrate ) { #>
@@ -372,25 +419,30 @@
 			</div>
 
 			<div class="settings">
-				<label class="setting" data-setting="url">
-					<span class="name"><?php _e('URL'); ?></span>
-					<input type="text" value="{{ data.url }}" readonly />
-				</label>
 				<# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
+				<# if ( 'image' === data.type ) { #>
+					<label class="setting" data-setting="alt">
+						<span class="name"><?php _e( 'Alternative Text' ); ?></span>
+						<input type="text" value="{{ data.alt }}" aria-describedby="alt-text-description" {{ maybeReadOnly }} />
+					</label>
+					<p class="description" id="alt-text-description"><?php echo $alt_text_description; ?></p>
+				<# } #>
 				<?php if ( post_type_supports( 'attachment', 'title' ) ) : ?>
 				<label class="setting" data-setting="title">
-					<span class="name"><?php _e('Title'); ?></span>
+					<span class="name"><?php _e( 'Title' ); ?></span>
 					<input type="text" value="{{ data.title }}" {{ maybeReadOnly }} />
 				</label>
 				<?php endif; ?>
 				<# if ( 'audio' === data.type ) { #>
-				<?php foreach ( array(
+				<?php
+				foreach ( array(
 					'artist' => __( 'Artist' ),
-					'album' => __( 'Album' ),
-				) as $key => $label ) : ?>
-				<label class="setting" data-setting="<?php echo esc_attr( $key ) ?>">
-					<span class="name"><?php echo $label ?></span>
-					<input type="text" value="{{ data.<?php echo $key ?> || data.meta.<?php echo $key ?> || '' }}" />
+					'album'  => __( 'Album' ),
+				) as $key => $label ) :
+					?>
+				<label class="setting" data-setting="<?php echo esc_attr( $key ); ?>">
+					<span class="name"><?php echo $label; ?></span>
+					<input type="text" value="{{ data.<?php echo $key; ?> || data.meta.<?php echo $key; ?> || '' }}" />
 				</label>
 				<?php endforeach; ?>
 				<# } #>
@@ -398,46 +450,44 @@
 					<span class="name"><?php _e( 'Caption' ); ?></span>
 					<textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea>
 				</label>
-				<# if ( 'image' === data.type ) { #>
-					<label class="setting" data-setting="alt">
-						<span class="name"><?php _e( 'Alt Text' ); ?></span>
-						<input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} />
-					</label>
-				<# } #>
 				<label class="setting" data-setting="description">
-					<span class="name"><?php _e('Description'); ?></span>
+					<span class="name"><?php _e( 'Description' ); ?></span>
 					<textarea {{ maybeReadOnly }}>{{ data.description }}</textarea>
 				</label>
-				<label class="setting">
+				<div class="setting">
 					<span class="name"><?php _e( 'Uploaded By' ); ?></span>
 					<span class="value">{{ data.authorName }}</span>
-				</label>
+				</div>
 				<# if ( data.uploadedToTitle ) { #>
-					<label class="setting">
+					<div class="setting">
 						<span class="name"><?php _e( 'Uploaded To' ); ?></span>
 						<# if ( data.uploadedToLink ) { #>
 							<span class="value"><a href="{{ data.uploadedToLink }}">{{ data.uploadedToTitle }}</a></span>
 						<# } else { #>
 							<span class="value">{{ data.uploadedToTitle }}</span>
 						<# } #>
-					</label>
+					</div>
 				<# } #>
+				<label class="setting" data-setting="url">
+					<span class="name"><?php _e( 'Copy Link' ); ?></span>
+					<input type="text" value="{{ data.url }}" readonly />
+				</label>
 				<div class="attachment-compat"></div>
 			</div>
 
 			<div class="actions">
 				<a class="view-attachment" href="{{ data.link }}"><?php _e( 'View attachment page' ); ?></a>
 				<# if ( data.can.save ) { #> |
-					<a href="post.php?post={{ data.id }}&action=edit"><?php _e( 'Edit more details' ); ?></a>
+					<a href="{{ data.editLink }}"><?php _e( 'Edit more details' ); ?></a>
 				<# } #>
 				<# if ( ! data.uploading && data.can.remove ) { #> |
-					<?php if ( MEDIA_TRASH ): ?>
+					<?php if ( MEDIA_TRASH ) : ?>
 						<# if ( 'trash' === data.status ) { #>
-							<button type="button" class="button-link untrash-attachment"><?php _e( 'Untrash' ); ?></button>
+							<button type="button" class="button-link untrash-attachment"><?php _e( 'Restore from Trash' ); ?></button>
 						<# } else { #>
-							<button type="button" class="button-link trash-attachment"><?php _ex( 'Trash', 'verb' ); ?></button>
+							<button type="button" class="button-link trash-attachment"><?php _e( 'Move to Trash' ); ?></button>
 						<# } #>
-					<?php else: ?>
+					<?php else : ?>
 						<button type="button" class="button-link delete-attachment"><?php _e( 'Delete Permanently' ); ?></button>
 					<?php endif; ?>
 				<# } #>
@@ -482,15 +532,15 @@
 		if ( data.describe ) {
 			if ( 'image' === data.type ) { #>
 				<input type="text" value="{{ data.caption }}" class="describe" data-setting="caption"
-					placeholder="<?php esc_attr_e('Caption this image&hellip;'); ?>" {{ maybeReadOnly }} />
+					placeholder="<?php esc_attr_e( 'Caption this image&hellip;' ); ?>" {{ maybeReadOnly }} />
 			<# } else { #>
 				<input type="text" value="{{ data.title }}" class="describe" data-setting="title"
 					<# if ( 'video' === data.type ) { #>
-						placeholder="<?php esc_attr_e('Describe this video&hellip;'); ?>"
+						placeholder="<?php esc_attr_e( 'Describe this video&hellip;' ); ?>"
 					<# } else if ( 'audio' === data.type ) { #>
-						placeholder="<?php esc_attr_e('Describe this audio file&hellip;'); ?>"
+						placeholder="<?php esc_attr_e( 'Describe this audio file&hellip;' ); ?>"
 					<# } else { #>
-						placeholder="<?php esc_attr_e('Describe this media file&hellip;'); ?>"
+						placeholder="<?php esc_attr_e( 'Describe this media file&hellip;' ); ?>"
 					<# } #> {{ maybeReadOnly }} />
 			<# }
 		} #>
@@ -501,7 +551,7 @@
 			<?php _e( 'Attachment Details' ); ?>
 			<span class="settings-save-status">
 				<span class="spinner"></span>
-				<span class="saved"><?php esc_html_e('Saved.'); ?></span>
+				<span class="saved"><?php esc_html_e( 'Saved.' ); ?></span>
 			</span>
 		</h2>
 		<div class="attachment-info">
@@ -521,7 +571,12 @@
 				<div class="file-size">{{ data.filesizeHumanReadable }}</div>
 				<# if ( 'image' === data.type && ! data.uploading ) { #>
 					<# if ( data.width && data.height ) { #>
-						<div class="dimensions">{{ data.width }} &times; {{ data.height }}</div>
+						<div class="dimensions">
+							<?php
+							/* translators: 1: a number of pixels wide, 2: a number of pixels tall. */
+							printf( __( '%1$s by %2$s pixels' ), '{{ data.width }}', '{{ data.height }}' );
+							?>
+						</div>
 					<# } #>
 
 					<# if ( data.can.save && data.sizes ) { #>
@@ -529,18 +584,21 @@
 					<# } #>
 				<# } #>
 
-				<# if ( data.fileLength ) { #>
-					<div class="file-length"><?php _e( 'Length:' ); ?> {{ data.fileLength }}</div>
+				<# if ( data.fileLength && data.fileLengthHumanReadable ) { #>
+					<div class="file-length"><?php _e( 'Length:' ); ?>
+						<span aria-hidden="true">{{ data.fileLength }}</span>
+						<span class="screen-reader-text">{{ data.fileLengthHumanReadable }}</span>
+					</div>
 				<# } #>
 
 				<# if ( ! data.uploading && data.can.remove ) { #>
-					<?php if ( MEDIA_TRASH ): ?>
+					<?php if ( MEDIA_TRASH ) : ?>
 					<# if ( 'trash' === data.status ) { #>
-						<button type="button" class="button-link untrash-attachment"><?php _e( 'Untrash' ); ?></button>
+						<button type="button" class="button-link untrash-attachment"><?php _e( 'Restore from Trash' ); ?></button>
 					<# } else { #>
-						<button type="button" class="button-link trash-attachment"><?php _ex( 'Trash', 'verb' ); ?></button>
+						<button type="button" class="button-link trash-attachment"><?php _e( 'Move to Trash' ); ?></button>
 					<# } #>
-					<?php else: ?>
+					<?php else : ?>
 						<button type="button" class="button-link delete-attachment"><?php _e( 'Delete Permanently' ); ?></button>
 					<?php endif; ?>
 				<# } #>
@@ -553,42 +611,45 @@
 			</div>
 		</div>
 
-		<label class="setting" data-setting="url">
-			<span class="name"><?php _e('URL'); ?></span>
-			<input type="text" value="{{ data.url }}" readonly />
-		</label>
 		<# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
+		<# if ( 'image' === data.type ) { #>
+			<label class="setting" data-setting="alt">
+				<span class="name"><?php _e( 'Alt Text' ); ?></span>
+				<input type="text" value="{{ data.alt }}" aria-describedby="alt-text-description" {{ maybeReadOnly }} />
+			</label>
+			<p class="description" id="alt-text-description"><?php echo $alt_text_description; ?></p>
+		<# } #>
 		<?php if ( post_type_supports( 'attachment', 'title' ) ) : ?>
 		<label class="setting" data-setting="title">
-			<span class="name"><?php _e('Title'); ?></span>
+			<span class="name"><?php _e( 'Title' ); ?></span>
 			<input type="text" value="{{ data.title }}" {{ maybeReadOnly }} />
 		</label>
 		<?php endif; ?>
 		<# if ( 'audio' === data.type ) { #>
-		<?php foreach ( array(
+		<?php
+		foreach ( array(
 			'artist' => __( 'Artist' ),
-			'album' => __( 'Album' ),
-		) as $key => $label ) : ?>
-		<label class="setting" data-setting="<?php echo esc_attr( $key ) ?>">
-			<span class="name"><?php echo $label ?></span>
-			<input type="text" value="{{ data.<?php echo $key ?> || data.meta.<?php echo $key ?> || '' }}" />
+			'album'  => __( 'Album' ),
+		) as $key => $label ) :
+			?>
+		<label class="setting" data-setting="<?php echo esc_attr( $key ); ?>">
+			<span class="name"><?php echo $label; ?></span>
+			<input type="text" value="{{ data.<?php echo $key; ?> || data.meta.<?php echo $key; ?> || '' }}" />
 		</label>
 		<?php endforeach; ?>
 		<# } #>
 		<label class="setting" data-setting="caption">
-			<span class="name"><?php _e('Caption'); ?></span>
+			<span class="name"><?php _e( 'Caption' ); ?></span>
 			<textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea>
 		</label>
-		<# if ( 'image' === data.type ) { #>
-			<label class="setting" data-setting="alt">
-				<span class="name"><?php _e('Alt Text'); ?></span>
-				<input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} />
-			</label>
-		<# } #>
 		<label class="setting" data-setting="description">
-			<span class="name"><?php _e('Description'); ?></span>
+			<span class="name"><?php _e( 'Description' ); ?></span>
 			<textarea {{ maybeReadOnly }}>{{ data.description }}</textarea>
 		</label>
+		<label class="setting" data-setting="url">
+			<span class="name"><?php _e( 'Copy Link' ); ?></span>
+			<input type="text" value="{{ data.url }}" readonly />
+		</label>
 	</script>
 
 	<script type="text/html" id="tmpl-media-selection">
@@ -609,7 +670,7 @@
 
 		<# if ( 'image' === data.type ) { #>
 			<label class="setting align">
-				<span><?php _e('Alignment'); ?></span>
+				<span><?php _e( 'Alignment' ); ?></span>
 				<select class="alignment"
 					data-setting="align"
 					<# if ( data.userSettings ) { #>
@@ -635,9 +696,9 @@
 		<div class="setting">
 			<label>
 				<# if ( data.model.canEmbed ) { #>
-					<span><?php _e('Embed or Link'); ?></span>
+					<span><?php _e( 'Embed or Link' ); ?></span>
 				<# } else { #>
-					<span><?php _e('Link To'); ?></span>
+					<span><?php _e( 'Link To' ); ?></span>
 				<# } #>
 
 				<select class="link-to"
@@ -682,7 +743,7 @@
 
 		<# if ( 'undefined' !== typeof data.sizes ) { #>
 			<label class="setting">
-				<span><?php _e('Size'); ?></span>
+				<span><?php _e( 'Size' ); ?></span>
 				<select class="size" name="size"
 					data-setting="size"
 					<# if ( data.userSettings ) { #>
@@ -690,14 +751,18 @@
 					<# } #>>
 					<?php
 					/** This filter is documented in wp-admin/includes/media.php */
-					$sizes = apply_filters( 'image_size_names_choose', array(
-						'thumbnail' => __('Thumbnail'),
-						'medium'    => __('Medium'),
-						'large'     => __('Large'),
-						'full'      => __('Full Size'),
-					) );
+					$sizes = apply_filters(
+						'image_size_names_choose',
+						array(
+							'thumbnail' => __( 'Thumbnail' ),
+							'medium'    => __( 'Medium' ),
+							'large'     => __( 'Large' ),
+							'full'      => __( 'Full Size' ),
+						)
+					);
 
-					foreach ( $sizes as $value => $name ) : ?>
+					foreach ( $sizes as $value => $name ) :
+						?>
 						<#
 						var size = data.sizes['<?php echo esc_js( $value ); ?>'];
 						if ( size ) { #>
@@ -715,7 +780,7 @@
 		<h2><?php _e( 'Gallery Settings' ); ?></h2>
 
 		<label class="setting">
-			<span><?php _e('Link To'); ?></span>
+			<span><?php _e( 'Link To' ); ?></span>
 			<select class="link-to"
 				data-setting="link"
 				<# if ( data.userSettings ) { #>
@@ -737,12 +802,12 @@
 		</label>
 
 		<label class="setting">
-			<span><?php _e('Columns'); ?></span>
+			<span><?php _e( 'Columns' ); ?></span>
 			<select class="columns" name="columns"
 				data-setting="columns">
 				<?php for ( $i = 1; $i <= 9; $i++ ) : ?>
 					<option value="<?php echo esc_attr( $i ); ?>" <#
-						if ( <?php echo $i ?> == wp.media.galleryDefaults.columns ) { #>selected="selected"<# }
+						if ( <?php echo $i; ?> == wp.media.galleryDefaults.columns ) { #>selected="selected"<# }
 					#>>
 						<?php echo esc_html( $i ); ?>
 					</option>
@@ -765,14 +830,18 @@
 				>
 				<?php
 				/** This filter is documented in wp-admin/includes/media.php */
-				$size_names = apply_filters( 'image_size_names_choose', array(
-					'thumbnail' => __( 'Thumbnail' ),
-					'medium'    => __( 'Medium' ),
-					'large'     => __( 'Large' ),
-					'full'      => __( 'Full Size' ),
-				) );
+				$size_names = apply_filters(
+					'image_size_names_choose',
+					array(
+						'thumbnail' => __( 'Thumbnail' ),
+						'medium'    => __( 'Medium' ),
+						'large'     => __( 'Large' ),
+						'full'      => __( 'Full Size' ),
+					)
+				);
 
-				foreach ( $size_names as $size => $label ) : ?>
+				foreach ( $size_names as $size => $label ) :
+					?>
 					<option value="<?php echo esc_attr( $size ); ?>">
 						<?php echo esc_html( $label ); ?>
 					</option>
@@ -830,22 +899,24 @@
 			<img src="{{ data.model.url }}" draggable="false" alt="" />
 		</div>
 
+		<label class="setting alt-text has-description">
+			<span><?php _e( 'Alternative Text' ); ?></span>
+			<input type="text" data-setting="alt" aria-describedby="alt-text-description" />
+		</label>
+		<p class="description" id="alt-text-description"><?php echo $alt_text_description; ?></p>
+
 		<?php
 		/** This filter is documented in wp-admin/includes/media.php */
-		if ( ! apply_filters( 'disable_captions', '' ) ) : ?>
+		if ( ! apply_filters( 'disable_captions', '' ) ) :
+			?>
 			<label class="setting caption">
-				<span><?php _e('Caption'); ?></span>
+				<span><?php _e( 'Caption' ); ?></span>
 				<textarea data-setting="caption" />
 			</label>
 		<?php endif; ?>
 
-		<label class="setting alt-text">
-			<span><?php _e('Alt Text'); ?></span>
-			<input type="text" data-setting="alt" />
-		</label>
-
 		<div class="setting align">
-			<span><?php _e('Align'); ?></span>
+			<span><?php _e( 'Align' ); ?></span>
 			<div class="button-group button-large" data-setting="align">
 				<button class="button" value="left">
 					<?php esc_html_e( 'Left' ); ?>
@@ -863,7 +934,7 @@
 		</div>
 
 		<div class="setting link-to">
-			<span><?php _e('Link To'); ?></span>
+			<span><?php _e( 'Link To' ); ?></span>
 			<div class="button-group button-large" data-setting="link">
 				<button class="button" value="file">
 					<?php esc_html_e( 'Image URL' ); ?>
@@ -895,23 +966,25 @@
 					</div>
 				</div>
 				<div class="column-settings">
+					<label class="setting alt-text has-description">
+						<span><?php _e( 'Alternative Text' ); ?></span>
+						<input type="text" data-setting="alt" value="{{ data.model.alt }}" aria-describedby="alt-text-description" />
+					</label>
+					<p class="description" id="alt-text-description"><?php echo $alt_text_description; ?></p>
+
 					<?php
 					/** This filter is documented in wp-admin/includes/media.php */
-					if ( ! apply_filters( 'disable_captions', '' ) ) : ?>
+					if ( ! apply_filters( 'disable_captions', '' ) ) :
+						?>
 						<label class="setting caption">
-							<span><?php _e('Caption'); ?></span>
+							<span><?php _e( 'Caption' ); ?></span>
 							<textarea data-setting="caption">{{ data.model.caption }}</textarea>
 						</label>
 					<?php endif; ?>
 
-					<label class="setting alt-text">
-						<span><?php _e('Alternative Text'); ?></span>
-						<input type="text" data-setting="alt" value="{{ data.model.alt }}" />
-					</label>
-
 					<h2><?php _e( 'Display Settings' ); ?></h2>
 					<div class="setting align">
-						<span><?php _e('Align'); ?></span>
+						<span><?php _e( 'Align' ); ?></span>
 						<div class="button-group button-large" data-setting="align">
 							<button class="button" value="left">
 								<?php esc_html_e( 'Left' ); ?>
@@ -931,7 +1004,7 @@
 					<# if ( data.attachment ) { #>
 						<# if ( 'undefined' !== typeof data.attachment.sizes ) { #>
 							<label class="setting size">
-								<span><?php _e('Size'); ?></span>
+								<span><?php _e( 'Size' ); ?></span>
 								<select class="size" name="size"
 									data-setting="size"
 									<# if ( data.userSettings ) { #>
@@ -939,14 +1012,18 @@
 									<# } #>>
 									<?php
 									/** This filter is documented in wp-admin/includes/media.php */
-									$sizes = apply_filters( 'image_size_names_choose', array(
-										'thumbnail' => __('Thumbnail'),
-										'medium'    => __('Medium'),
-										'large'     => __('Large'),
-										'full'      => __('Full Size'),
-									) );
+									$sizes = apply_filters(
+										'image_size_names_choose',
+										array(
+											'thumbnail' => __( 'Thumbnail' ),
+											'medium'    => __( 'Medium' ),
+											'large'     => __( 'Large' ),
+											'full'      => __( 'Full Size' ),
+										)
+									);
 
-									foreach ( $sizes as $value => $name ) : ?>
+									foreach ( $sizes as $value => $name ) :
+										?>
 										<#
 										var size = data.sizes['<?php echo esc_js( $value ); ?>'];
 										if ( size ) { #>
@@ -967,7 +1044,7 @@
 					<# } #>
 
 					<div class="setting link-to">
-						<span><?php _e('Link To'); ?></span>
+						<span><?php _e( 'Link To' ); ?></span>
 						<select data-setting="link">
 						<# if ( data.attachment ) { #>
 							<option value="file">
@@ -995,11 +1072,11 @@
 						<div class="advanced-settings hidden">
 							<div class="advanced-image">
 								<label class="setting title-text">
-									<span><?php _e('Image Title Attribute'); ?></span>
+									<span><?php _e( 'Image Title Attribute' ); ?></span>
 									<input type="text" data-setting="title" value="{{ data.model.title }}" />
 								</label>
 								<label class="setting extra-classes">
-									<span><?php _e('Image CSS Class'); ?></span>
+									<span><?php _e( 'Image CSS Class' ); ?></span>
 									<input type="text" data-setting="extraClasses" value="{{ data.model.extraClasses }}" />
 								</label>
 							</div>
@@ -1008,11 +1085,11 @@
 									<label><input type="checkbox" data-setting="linkTargetBlank" value="_blank" <# if ( data.model.linkTargetBlank ) { #>checked="checked"<# } #>><?php _e( 'Open link in a new tab' ); ?></label>
 								</div>
 								<label class="setting link-rel">
-									<span><?php _e('Link Rel'); ?></span>
+									<span><?php _e( 'Link Rel' ); ?></span>
 									<input type="text" data-setting="linkRel" value="{{ data.model.linkRel }}" />
 								</label>
 								<label class="setting link-class-name">
-									<span><?php _e('Link CSS Class'); ?></span>
+									<span><?php _e( 'Link CSS Class' ); ?></span>
 									<input type="text" data-setting="linkClassName" value="{{ data.model.linkClassName }}" />
 								</label>
 							</div>
@@ -1037,7 +1114,7 @@
 		<?php $audio_types = wp_get_audio_extensions(); ?>
 		<div class="media-embed media-embed-details">
 			<div class="embed-media-settings embed-audio-settings">
-				<?php wp_underscore_audio_template() ?>
+				<?php wp_underscore_audio_template(); ?>
 
 				<# if ( ! _.isEmpty( data.model.src ) ) {
 					ext = data.model.src.split('.').pop();
@@ -1045,31 +1122,32 @@
 						delete html5types[ ext ];
 					}
 				#>
-				<label class="setting">
-					<span>SRC</span>
-					<input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" />
+				<div class="setting">
+					<label for="audio-source"><?php _e( 'URL' ); ?></label>
+					<input type="text" id="audio-source" readonly data-setting="src" value="{{ data.model.src }}" />
 					<button type="button" class="button-link remove-setting"><?php _e( 'Remove audio source' ); ?></button>
-				</label>
+				</div>
 				<# } #>
 				<?php
 
-				foreach ( $audio_types as $type ):
-				?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) {
-					if ( ! _.isUndefined( html5types.<?php echo $type ?> ) ) {
-						delete html5types.<?php echo $type ?>;
+				foreach ( $audio_types as $type ) :
+					?>
+				<# if ( ! _.isEmpty( data.model.<?php echo $type; ?> ) ) {
+					if ( ! _.isUndefined( html5types.<?php echo $type; ?> ) ) {
+						delete html5types.<?php echo $type; ?>;
 					}
 				#>
-				<label class="setting">
-					<span><?php echo strtoupper( $type ) ?></span>
-					<input type="text" disabled="disabled" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" />
+				<div class="setting">
+					<label for="<?php echo $type . '-source'; ?>"><?php echo strtoupper( $type ); ?></span>
+					<input type="text" id="<?php echo $type . '-source'; ?>" readonly data-setting="<?php echo $type; ?>" value="{{ data.model.<?php echo $type; ?> }}" />
 					<button type="button" class="button-link remove-setting"><?php _e( 'Remove audio source' ); ?></button>
-				</label>
+				</div>
 				<# } #>
 				<?php endforeach ?>
 
 				<# if ( ! _.isEmpty( html5types ) ) { #>
 				<div class="setting">
-					<span><?php _e( 'Add alternate sources for maximum HTML5 playback:' ) ?></span>
+					<span><?php _e( 'Add alternate sources for maximum HTML5 playback:' ); ?></span>
 					<div class="button-large">
 					<# _.each( html5types, function (mime, type) { #>
 					<button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button>
@@ -1120,7 +1198,7 @@
 				}
 				#>
 
-				<?php wp_underscore_video_template() ?>
+				<?php wp_underscore_video_template(); ?>
 
 				<# if ( ! _.isEmpty( data.model.src ) ) {
 					ext = data.model.src.split('.').pop();
@@ -1128,23 +1206,25 @@
 						delete html5types[ ext ];
 					}
 				#>
-				<label class="setting">
-					<span>SRC</span>
-					<input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" />
+				<div class="setting">
+					<label for="video-source"><?php _e( 'URL' ); ?></label>
+					<input type="text" id="video-source" readonly data-setting="src" value="{{ data.model.src }}" />
 					<button type="button" class="button-link remove-setting"><?php _e( 'Remove video source' ); ?></button>
-				</label>
+				</div>
 				<# } #>
-				<?php foreach ( $video_types as $type ):
-				?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) {
-					if ( ! _.isUndefined( html5types.<?php echo $type ?> ) ) {
-						delete html5types.<?php echo $type ?>;
+				<?php
+				foreach ( $video_types as $type ) :
+					?>
+				<# if ( ! _.isEmpty( data.model.<?php echo $type; ?> ) ) {
+					if ( ! _.isUndefined( html5types.<?php echo $type; ?> ) ) {
+						delete html5types.<?php echo $type; ?>;
 					}
 				#>
-				<label class="setting">
-					<span><?php echo strtoupper( $type ) ?></span>
-					<input type="text" disabled="disabled" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" />
+				<div class="setting">
+					<label for="<?php echo $type . '-source'; ?>"><?php echo strtoupper( $type ); ?></label>
+					<input type="text" id="<?php echo $type . '-source'; ?>" readonly data-setting="<?php echo $type; ?>" value="{{ data.model.<?php echo $type; ?> }}" />
 					<button type="button" class="button-link remove-setting"><?php _e( 'Remove video source' ); ?></button>
-				</label>
+				</div>
 				<# } #>
 				<?php endforeach ?>
 				</div>
@@ -1161,11 +1241,11 @@
 				<# } #>
 
 				<# if ( ! _.isEmpty( data.model.poster ) ) { #>
-				<label class="setting">
-					<span><?php _e( 'Poster Image' ); ?></span>
-					<input type="text" disabled="disabled" data-setting="poster" value="{{ data.model.poster }}" />
+				<div class="setting">
+					<label for="poster-image"><?php _e( 'Poster Image' ); ?></label>
+					<input type="text" id="poster-image" readonly data-setting="poster" value="{{ data.model.poster }}" />
 					<button type="button" class="button-link remove-setting"><?php _e( 'Remove poster image' ); ?></button>
-				</label>
+				</div>
 				<# } #>
 				<div class="setting preload">
 					<span><?php _e( 'Preload' ); ?></span>
@@ -1186,24 +1266,23 @@
 					<span><?php _e( 'Loop' ); ?></span>
 				</label>
 
-				<label class="setting" data-setting="content">
-					<span><?php _e( 'Tracks (subtitles, captions, descriptions, chapters, or metadata)' ); ?></span>
+				<div class="setting" data-setting="content">
 					<#
 					var content = '';
 					if ( ! _.isEmpty( data.model.content ) ) {
 						var tracks = jQuery( data.model.content ).filter( 'track' );
 						_.each( tracks.toArray(), function (track) {
 							content += track.outerHTML; #>
-						<p>
-							<input class="content-track" type="text" value="{{ track.outerHTML }}" />
-							<button type="button" class="button-link remove-setting remove-track"><?php _ex( 'Remove video track', 'media' ); ?></button>
-						</p>
+						<label for="video-track"><?php _e( 'Tracks (subtitles, captions, descriptions, chapters, or metadata)' ); ?></span>
+						<input class="content-track" type="text" id="video-track" readonly value="{{ track.outerHTML }}" />
+						<button type="button" class="button-link remove-setting remove-track"><?php _ex( 'Remove video track', 'media' ); ?></button>
 						<# } ); #>
 					<# } else { #>
+					<span><?php _e( 'Tracks (subtitles, captions, descriptions, chapters, or metadata)' ); ?></span>
 					<em><?php _e( 'There are no associated subtitles.' ); ?></em>
 					<# } #>
 					<textarea class="hidden content-setting">{{ content }}</textarea>
-				</label>
+				</div>
 			</div>
 		</div>
 	</script>
@@ -1215,9 +1294,9 @@
 					<dl class="gallery-item">
 						<dt class="gallery-icon">
 							<# if ( attachment.thumbnail ) { #>
-								<img src="{{ attachment.thumbnail.url }}" width="{{ attachment.thumbnail.width }}" height="{{ attachment.thumbnail.height }}" alt="" />
+								<img src="{{ attachment.thumbnail.url }}" width="{{ attachment.thumbnail.width }}" height="{{ attachment.thumbnail.height }}" alt="{{ attachment.alt }}" />
 							<# } else { #>
-								<img src="{{ attachment.url }}" alt="" />
+								<img src="{{ attachment.url }}" alt="{{ attachment.alt }}" />
 							<# } #>
 						</dt>
 						<# if ( attachment.caption ) { #>