[wp-trac] [WordPress Trac] #50066: Make alt text input a textarea on classic editor

WordPress Trac noreply at wordpress.org
Mon Jul 6 08:19:10 UTC 2020


#50066: Make alt text input a textarea on classic editor
-------------------------------------+--------------------------------
 Reporter:  edent                    |       Owner:  sabernhardt
     Type:  enhancement              |      Status:  assigned
 Priority:  normal                   |   Milestone:  5.5
Component:  Media                    |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-refresh  |     Focuses:  ui, accessibility
-------------------------------------+--------------------------------
Changes (by afercia):

 * keywords:  has-patch => has-patch needs-refresh


Comment:

 Thanks @sabernhardt !

 > If we change line-height for consistency, I'd like to set all of those
 fields to 1.5 i

 We aim to get computed values that are integers. 13 pixels multiplied by
 1.5 would give 19.5. Values with decimals are subject to browsers
 rounding. Not surprisingly, browsers use different rounding algorithms so
 that the final result may differ across browsers. This is the reason why
 we tend to use line-height values with decimals (Chrome especially needs a
 lot of decimals) to get a ''computed'' value without decimals. For
 example, with a font-size of 14 pixels, a `1.42857143` line-height is
 computed to 20.

 > setting a max-width of 500px on the Alt Text field

 Yeah, I have no strong opinions. However, the alt text textarea needs to
 suggest users that the text needs to be short. Shorter than the caption.
 Open to other suggestions. In the last patch seems to me in one case the
 textarea height is too small and looks like an input field.

 > line breaks
 To my understanding, when the alt text is saved either via form submission
 or via AJAX, it goes through `wp_strip_all_tags( $alt, true );`. Notice
 the second parameter `true` which makes the function remove line breaks.
 Thus, the alt text is stored in the database without line breaks. See
 screenshot below. This is a good first step :)

 However, when editing a post, the alt text is added to the HTML blob "as
 is", ''with'' the line breaks. I think this should be fixed in the Media
 views.

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


More information about the wp-trac mailing list