Make WordPress Core


Ignore:
Timestamp:
09/20/2022 04:00:35 AM (4 years ago)
Author:
joedolson
Message:

Media: Change alt attribute field to textarea in media library.

Change the input field used for alt attributes in the media library views from a text input to a textarea. This gives users more flexibility in resizing the field for easier management of longer alt attributes.

This patch includes a less-common use of esc_attr for a textarea. This is because the primary usage of the alt attribute will be escaped using esc_attr, and the value in editing should match the value output on the front end.

Props edent, sabernhardt, afercia, JavierCasares, audrasjb, joedolson.
Fixes #50066.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/media.php

    r54094 r54243  
    32083208                <p class="attachment-alt-text">
    32093209                        <label for="attachment_alt"><strong><?php _e( 'Alternative Text' ); ?></strong></label><br />
    3210                         <input type="text" class="widefat" name="_wp_attachment_image_alt" id="attachment_alt" aria-describedby="alt-text-description" value="<?php echo esc_attr( $alt_text ); ?>" />
     3210                        <textarea class="widefat" name="_wp_attachment_image_alt" id="attachment_alt" aria-describedby="alt-text-description"><?php echo esc_attr( $alt_text ); ?></textarea>
    32113211                </p>
    32123212                <p class="attachment-alt-text-description" id="alt-text-description">
Note: See TracChangeset for help on using the changeset viewer.