Accessibility: add missing alt attributes to a gaggle of <img>s.

Props afercia.
Fixes #34583.


git-svn-id: https://develop.svn.wordpress.org/trunk@35567 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-11-07 16:11:38 +00:00
parent b55053ba07
commit 7301c115aa
16 changed files with 37 additions and 37 deletions

View File

@ -134,7 +134,7 @@ $tech_features = array(
// Image.
else:
?>
<img src="<?php echo esc_url( $feature['src'] ); ?>" />
<img src="<?php echo esc_url( $feature['src'] ); ?>" alt="" />
<?php endif; ?>
</div>
<h3><?php echo $feature['heading']; ?></h3>
@ -147,7 +147,7 @@ $tech_features = array(
<?php foreach ( $minor_features as $feature ) : ?>
<div class="col">
<div class="svg-container">
<img src="<?php echo esc_attr( $feature['src'] ); ?>" />
<img src="<?php echo esc_attr( $feature['src'] ); ?>" alt="" />
</div>
<h3><?php echo $feature['heading']; ?></h3>
<p><?php echo $feature['description']; ?></p>

View File

@ -771,7 +771,7 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
<p class="hide-if-js"><strong><?php _e( 'You need JavaScript to choose a part of the image.'); ?></strong></p>
<div id="crop_image" style="position: relative">
<img src="<?php echo esc_url( $url ); ?>" id="upload" width="<?php echo $width; ?>" height="<?php echo $height; ?>" />
<img src="<?php echo esc_url( $url ); ?>" id="upload" width="<?php echo $width; ?>" height="<?php echo $height; ?>" alt="" />
</div>
<input type="hidden" name="x1" id="x1" value="0"/>

View File

@ -302,7 +302,7 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
?>
<a class="screenshot install-theme-preview" href="<?php echo esc_url( $preview_url ); ?>" title="<?php echo esc_attr( $preview_title ); ?>">
<img src="<?php echo esc_url( $theme->screenshot_url ); ?>" width="150" />
<img src="<?php echo esc_url( $theme->screenshot_url ); ?>" width="150" alt="" />
</a>
<h3><?php echo $name; ?></h3>
@ -412,7 +412,7 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
<h3 class="theme-name"><?php echo $name; ?></h3>
<span class="theme-by"><?php printf( __( 'By %s' ), $author ); ?></span>
<?php if ( isset( $theme->screenshot_url ) ): ?>
<img class="theme-screenshot" src="<?php echo esc_url( $theme->screenshot_url ); ?>" />
<img class="theme-screenshot" src="<?php echo esc_url( $theme->screenshot_url ); ?>" alt="" />
<?php endif; ?>
<div class="theme-details">
<?php wp_star_rating( array( 'rating' => $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings ) ); ?>

View File

@ -184,7 +184,7 @@ function wp_image_editor($post_id, $msg = false) {
<input type="hidden" id="imgedit-y-<?php echo $post_id; ?>" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" />
<div id="imgedit-crop-<?php echo $post_id; ?>" class="imgedit-crop-wrap">
<img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')" src="<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>?action=imgedit-preview&amp;_ajax_nonce=<?php echo $nonce; ?>&amp;postid=<?php echo $post_id; ?>&amp;rand=<?php echo rand(1, 99999); ?>" />
<img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')" src="<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>?action=imgedit-preview&amp;_ajax_nonce=<?php echo $nonce; ?>&amp;postid=<?php echo $post_id; ?>&amp;rand=<?php echo rand(1, 99999); ?>" alt="<?php esc_attr_e( 'Image preview' ); ?>" />
</div>
<div class="imgedit-submit">

View File

@ -605,9 +605,9 @@ function install_plugin_information() {
}
$contrib_username = sanitize_user( $contrib_username );
if ( empty( $contrib_profile ) ) {
echo "<li><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&amp;s=36' width='18' height='18' />{$contrib_username}</li>";
echo "<li><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&amp;s=36' width='18' height='18' alt='' />{$contrib_username}</li>";
} else {
echo "<li><a href='{$contrib_profile}' target='_blank'><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&amp;s=36' width='18' height='18' />{$contrib_username}</a></li>";
echo "<li><a href='{$contrib_profile}' target='_blank'><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&amp;s=36' width='18' height='18' alt='' />{$contrib_username}</a></li>";
}
}
?>

View File

@ -1615,7 +1615,7 @@ function _admin_notice_post_locked() {
<div class="post-locked-avatar"></div>
<p class="wp-tab-first" tabindex="0">
<span class="currently-editing"></span><br />
<span class="locked-saving hidden"><img src="<?php echo esc_url( admin_url( 'images/spinner-2x.gif' ) ); ?>" width="16" height="16" /> <?php _e('Saving revision&hellip;'); ?></span>
<span class="locked-saving hidden"><img src="<?php echo esc_url( admin_url( 'images/spinner-2x.gif' ) ); ?>" width="16" height="16" alt="" /> <?php _e( 'Saving revision&hellip;' ); ?></span>
<span class="locked-saved hidden"><?php _e('Your latest changes were saved as a revision.'); ?></span>
</p>
<?php

View File

@ -165,7 +165,7 @@ var imageEdit = window.imageEdit = {
'rand': t.intval(Math.random() * 1000000)
};
img = $('<img id="image-preview-' + postid + '" />')
img = $( '<img id="image-preview-' + postid + '" alt="" />' )
.on('load', function() {
var max1, max2, parent = $('#imgedit-crop-' + postid), t = imageEdit;

View File

@ -332,7 +332,7 @@ $( document ).on( 'heartbeat-tick.wp-check-locked-posts', function( e, data ) {
row.find('.check-column checkbox').prop('checked', false);
if ( lock_data.avatar_src ) {
avatar = $('<img class="avatar avatar-18 photo" width="18" height="18" />').attr( 'src', lock_data.avatar_src.replace(/&amp;/g, '&') );
avatar = $( '<img class="avatar avatar-18 photo" width="18" height="18" alt="" />' ).attr( 'src', lock_data.avatar_src.replace( /&amp;/g, '&' ) );
row.find('.column-title .locked-avatar').empty().append( avatar );
}
row.addClass('wp-locked');

View File

@ -131,7 +131,7 @@ $(document).on( 'heartbeat-send.refresh-lock', function( e, data ) {
}
if ( received.lock_error.avatar_src ) {
avatar = $('<img class="avatar avatar-64 photo" width="64" height="64" />').attr( 'src', received.lock_error.avatar_src.replace(/&amp;/g, '&') );
avatar = $( '<img class="avatar avatar-64 photo" width="64" height="64" alt="" />' ).attr( 'src', received.lock_error.avatar_src.replace( /&amp;/g, '&' ) );
wrap.find('div.post-locked-avatar').empty().append( avatar );
}

View File

@ -323,7 +323,7 @@
link = src;
}
newContent = '<a href="' + link + '"><img class="alignnone size-full" src="' + src + '" /></a>';
newContent = '<a href="' + link + '"><img class="alignnone size-full" src="' + src + '" alt="" /></a>';
} else {
newContent = '[embed]' + src + '[/embed]';
}

View File

@ -360,7 +360,7 @@ function list_theme_updates() {
echo "
<tr>
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr( $stylesheet ) . "' /></th>
<td class='plugin-title'><img src='" . esc_url( $theme->get_screenshot() ) . "' width='85' height='64' style='float:left; padding: 0 5px 5px' /><strong>" . $theme->display('Name') . '</strong> ' . sprintf( __( 'You have version %1$s installed. Update to %2$s.' ), $theme->display('Version'), $theme->update['new_version'] ) . "</td>
<td class='plugin-title'><img src='" . esc_url( $theme->get_screenshot() ) . "' width='85' height='64' style='float:left; padding: 0 5px 5px' alt='' /><strong>" . $theme->display('Name') . '</strong> ' . sprintf( __( 'You have version %1$s installed. Update to %2$s.' ), $theme->display('Version'), $theme->update['new_version'] ) . "</td>
</tr>";
}
?>

View File

@ -157,14 +157,14 @@ class WP_Customize_Media_Control extends WP_Customize_Control {
<div class="attachment-media-view attachment-media-view-{{ data.attachment.type }} {{ data.attachment.orientation }}">
<div class="thumbnail thumbnail-{{ data.attachment.type }}">
<# if ( 'image' === data.attachment.type && data.attachment.sizes && data.attachment.sizes.medium ) { #>
<img class="attachment-thumb" src="{{ data.attachment.sizes.medium.url }}" draggable="false" />
<img class="attachment-thumb" src="{{ data.attachment.sizes.medium.url }}" draggable="false" alt="" />
<# } else if ( 'image' === data.attachment.type && data.attachment.sizes && data.attachment.sizes.full ) { #>
<img class="attachment-thumb" src="{{ data.attachment.sizes.full.url }}" draggable="false" />
<img class="attachment-thumb" src="{{ data.attachment.sizes.full.url }}" draggable="false" alt="" />
<# } else if ( 'audio' === data.attachment.type ) { #>
<# if ( data.attachment.image && data.attachment.image.src && data.attachment.image.src !== data.attachment.icon ) { #>
<img src="{{ data.attachment.image.src }}" class="thumbnail" draggable="false" />
<img src="{{ data.attachment.image.src }}" class="thumbnail" draggable="false" alt="" />
<# } else { #>
<img src="{{ data.attachment.icon }}" class="attachment-thumb type-icon" draggable="false" />
<img src="{{ data.attachment.icon }}" class="attachment-thumb type-icon" draggable="false" alt="" />
<# } #>
<p class="attachment-meta attachment-meta-title">&#8220;{{ data.attachment.title }}&#8221;</p>
<# if ( data.attachment.album || data.attachment.meta.album ) { #>
@ -184,7 +184,7 @@ class WP_Customize_Media_Control extends WP_Customize_Control {
</video>
</div>
<# } else { #>
<img class="attachment-thumb type-icon icon" src="{{ data.attachment.icon }}" draggable="false" />
<img class="attachment-thumb type-icon icon" src="{{ data.attachment.icon }}" draggable="false" alt="" />
<p class="attachment-title">{{ data.attachment.title }}</p>
<# } #>
</div>

View File

@ -100,7 +100,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
event.content = event.content.replace( /<!--more(.*?)-->/g, function( match, moretext ) {
return '<img src="' + tinymce.Env.transparentSrc + '" data-wp-more="more" data-wp-more-text="' + moretext + '" ' +
'class="wp-more-tag mce-wp-more" title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />';
'class="wp-more-tag mce-wp-more" alt="" title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />';
});
}
@ -109,7 +109,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
event.content = event.content.replace( /<!--nextpage-->/g,
'<img src="' + tinymce.Env.transparentSrc + '" data-wp-more="nextpage" class="wp-more-tag mce-wp-nextpage" ' +
'title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />' );
'alt="" title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />' );
}
if ( event.load && event.format !== 'raw' && hasWpautop ) {
@ -162,7 +162,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
classname += ' mce-wp-' + tag;
title = tag === 'more' ? 'Read more...' : 'Next page';
title = __( title );
html = '<img src="' + tinymce.Env.transparentSrc + '" title="' + title + '" class="' + classname + '" ' +
html = '<img src="' + tinymce.Env.transparentSrc + '" alt="" title="' + title + '" class="' + classname + '" ' +
'data-wp-more="' + tag + '" data-mce-resize="false" data-mce-placeholder="1" />';
// Most common case

View File

@ -10,7 +10,7 @@ tinymce.PluginManager.add('wpgallery', function( editor ) {
function html( cls, data ) {
data = window.encodeURIComponent( data );
return '<img src="' + tinymce.Env.transparentSrc + '" class="wp-media mceItem ' + cls + '" ' +
'data-wp-media="' + data + '" data-mce-resize="false" data-mce-placeholder="1" />';
'data-wp-media="' + data + '" data-mce-resize="false" data-mce-placeholder="1" alt="" />';
}
function restoreMediaShortcodes( content ) {

View File

@ -291,11 +291,11 @@ function wp_print_media_templates() {
<# if ( data.uploading ) { #>
<div class="media-progress-bar"><div></div></div>
<# } else if ( 'image' === data.type && data.sizes && data.sizes.large ) { #>
<img class="details-image" src="{{ data.sizes.large.url }}" draggable="false" />
<img class="details-image" src="{{ data.sizes.large.url }}" draggable="false" alt="" />
<# } else if ( 'image' === data.type && data.sizes && data.sizes.full ) { #>
<img class="details-image" src="{{ data.sizes.full.url }}" draggable="false" />
<img class="details-image" src="{{ data.sizes.full.url }}" draggable="false" alt="" />
<# } else if ( -1 === jQuery.inArray( data.type, [ 'audio', 'video' ] ) ) { #>
<img class="details-image icon" src="{{ data.icon }}" draggable="false" />
<img class="details-image icon" src="{{ data.icon }}" draggable="false" alt="" />
<# } #>
<# if ( 'audio' === data.type ) { #>
@ -453,9 +453,9 @@ function wp_print_media_templates() {
<# } else { #>
<div class="centered">
<# if ( data.image && data.image.src && data.image.src !== data.icon ) { #>
<img src="{{ data.image.src }}" class="thumbnail" draggable="false" />
<img src="{{ data.image.src }}" class="thumbnail" draggable="false" alt="" />
<# } else { #>
<img src="{{ data.icon }}" class="icon" draggable="false" />
<img src="{{ data.icon }}" class="icon" draggable="false" alt="" />
<# } #>
</div>
<div class="filename">
@ -502,9 +502,9 @@ function wp_print_media_templates() {
<# if ( data.uploading ) { #>
<div class="media-progress-bar"><div></div></div>
<# } else if ( 'image' === data.type && data.sizes ) { #>
<img src="{{ data.size.url }}" draggable="false" />
<img src="{{ data.size.url }}" draggable="false" alt="" />
<# } else { #>
<img src="{{ data.icon }}" class="icon" draggable="false" />
<img src="{{ data.icon }}" class="icon" draggable="false" alt="" />
<# } #>
</div>
<div class="details">
@ -820,7 +820,7 @@ function wp_print_media_templates() {
<script type="text/html" id="tmpl-embed-image-settings">
<div class="thumbnail">
<img src="{{ data.model.url }}" draggable="false" />
<img src="{{ data.model.url }}" draggable="false" alt="" />
</div>
<?php
@ -877,7 +877,7 @@ function wp_print_media_templates() {
<div class="embed-media-settings">
<div class="column-image">
<div class="image">
<img src="{{ data.model.url }}" draggable="false" />
<img src="{{ data.model.url }}" draggable="false" alt="" />
<# if ( data.attachment && window.imageEdit ) { #>
<div class="actions">
@ -1208,9 +1208,9 @@ function wp_print_media_templates() {
<dl class="gallery-item">
<dt class="gallery-icon">
<# if ( attachment.thumbnail ) { #>
<img src="{{ attachment.thumbnail.url }}" width="{{ attachment.thumbnail.width }}" height="{{ attachment.thumbnail.height }}" />
<img src="{{ attachment.thumbnail.url }}" width="{{ attachment.thumbnail.width }}" height="{{ attachment.thumbnail.height }}" alt="" />
<# } else { #>
<img src="{{ attachment.url }}" />
<img src="{{ attachment.url }}" alt="" />
<# } #>
</dt>
<# if ( attachment.caption ) { #>
@ -1232,7 +1232,7 @@ function wp_print_media_templates() {
</script>
<script type="text/html" id="tmpl-crop-content">
<img class="crop-image" src="{{ data.url }}">
<img class="crop-image" src="{{ data.url }}" alt="">
<div class="upload-errors"></div>
</script>
@ -1240,7 +1240,7 @@ function wp_print_media_templates() {
<h2><?php _e( 'Preview' ); ?></h2>
<strong><?php _e( 'As a browser icon' ); ?></strong>
<div class="favicon-preview">
<img src="images/browser.png" class="browser-preview" width="182" height="" alt=""/>
<img src="images/browser.png" class="browser-preview" width="182" height="" alt="" />
<div class="favicon">
<img id="preview-favicon" src="{{ data.url }}" alt="<?php esc_attr_e( 'Preview as a browser icon' ); ?>"/>

View File

@ -1672,7 +1672,7 @@ function wp_underscore_playlist_templates() {
?>
<script type="text/html" id="tmpl-wp-playlist-current-item">
<# if ( data.image ) { #>
<img src="{{ data.thumb.src }}"/>
<img src="{{ data.thumb.src }}" alt="" />
<# } #>
<div class="wp-playlist-caption">
<span class="wp-playlist-item-meta wp-playlist-item-title"><?php