[wp-trac] [WordPress Trac] #62107: The WordPress media library does not use its own alt text

WordPress Trac noreply at wordpress.org
Tue Sep 24 21:37:58 UTC 2024


#62107: The WordPress media library does not use its own alt text
----------------------------+-----------------------------
 Reporter:  CynicalStudios  |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Upload          |    Version:  trunk
 Severity:  normal          |   Keywords:
  Focuses:  accessibility   |
----------------------------+-----------------------------
 The WordPress media library does not use its own alt text when displaying
 images.

 Steps to reproduce:

 1. Visit the media library (i.e. /wp-admin/upload.php)
 2. Upload and set alt text on several images
 3. None of the images displayed use their own alt text, rather they all
 have alt=""

 This is fixable by editing /wp-includes/media-template.php from as follows
 to use alt="{{ data.alt }}":

 (this section is findable by searching "attachment-preview js--select-
 attachment")


 {{{
 <div class="thumbnail">
                                 <# if ( data.uploading ) { #>
                                         <div class="media-progress-
 bar"><div style="width: {{ data.percent }}%"></div></div>
                                 <# } else if ( 'image' === data.type &&
 data.size && data.size.url ) { #>
                                         <div class="centered">
                                                 <img src="{{ data.size.url
 }}" draggable="false" alt="{{ data.alt }}" />
                                         </div>
                                 <# } else { #>
                                         <div class="centered">
                                                 <# if ( data.image &&
 data.image.src && data.image.src !== data.icon ) { #>
                                                         <img src="{{
 data.image.src }}" class="thumbnail" draggable="false" alt="{{ data.alt
 }}" />
                                                 <# } else if ( data.sizes
 && data.sizes.medium ) { #>
                                                         <img src="{{
 data.sizes.medium.url }}" class="thumbnail" draggable="false" alt="{{
 data.alt }}" />
                                                 <# } else { #>
                                                         <img src="{{
 data.icon }}" class="icon" draggable="false" alt="{{ data.alt }}" />
                                                 <# } #>
                                         </div>
                                         <div class="filename">
                                                 <div>{{ data.filename
 }}</div>
                                         </div>
                                 <# } #>
                         </div>
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62107>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list