[wp-trac] [WordPress Trac] #36735: Add media, insert from URL and alt attribute

WordPress Trac noreply at wordpress.org
Tue May 17 14:49:05 UTC 2016


#36735: Add media, insert from URL and alt attribute
--------------------------------------+------------------------------
 Reporter:  afercia                   |       Owner:
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Media                     |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  good-first-bug has-patch  |     Focuses:  accessibility
--------------------------------------+------------------------------
Changes (by ambrosey):

 * keywords:  needs-patch good-first-bug => good-first-bug has-patch


Comment:

 I looked into this and realized that the problem was that the filters set
 up on lines 57-61 of media-editor.js were not triggering,
 {{{
                                 if ( 'image' === props.type && ! props.alt
 ) {
                                         props.alt = props.caption ||
 props.title || '';
                                         props.alt = props.alt.replace(
 /<\/?[^>]+>/g, '' );
                                         props.alt = props.alt.replace(
 /[\r\n]+/g, ' ' );
                                 }
 }}}

 because props.type wasn't being assigned. This patch assigns props.type
 properly within the use case where the type is image, and enters this
 function properly.

 However, now the alt tag that comes through is picking up props.title
 which is defaulting to the URL being pulled -- i.e.
 {{{
 <img class="alignnone" src="https://cldup.com/YeRLlgnhxd.png" width="1195"
 height="249" alt="https://cldup.com/YeRLlgnhxd.png" />
 }}}

 I don't think that is what the behavior '''should be''', but I don't
 understand what the intent is for the alt to pick up in this case.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36735#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list