From af0242a37b972dfc0eee1e1424268dd866edc181 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Wed, 10 Apr 2019 19:59:16 +0000 Subject: [PATCH] Accessibility: Improve the image "Alternative Text" field in the Edit Media screen. Brings parity with the changes for the Media Views introduced in [44900]. - moves the alt text field to the top as first field - adds an explanatory text with a link pointing to the W3C "alt decision tree" tutorial - adds `aria-describedby` to target the explanatory text - adjusts the CSS and indentation Props chetan200891. Fixes #46875. git-svn-id: https://develop.svn.wordpress.org/trunk@45158 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/css/media.css | 7 ++++++ src/wp-admin/includes/media.php | 40 ++++++++++++++++++++++----------- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/src/wp-admin/css/media.css b/src/wp-admin/css/media.css index c45fa3b331..bb0f952aec 100644 --- a/src/wp-admin/css/media.css +++ b/src/wp-admin/css/media.css @@ -825,6 +825,13 @@ border color while dragging a file over the uploader drop area */ /*------------------------------------------------------------------------------ 14.2 - Image Editor ------------------------------------------------------------------------------*/ +.wp_attachment_details .attachment-alt-text { + margin-bottom: 5px; +} + +.wp_attachment_details .attachment-alt-text-description { + margin-top: 5px; +} .wp_attachment_details label[for="content"] { font-size: 13px; diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php index b07f4e5bc8..e30cc08b1b 100644 --- a/src/wp-admin/includes/media.php +++ b/src/wp-admin/includes/media.php @@ -3012,19 +3012,33 @@ function edit_form_image_editor( $post ) { ?>
+ post_mime_type, 0, 5 ) ) : ?> +

+
+ +

+

+ ', + sprintf( + ' %s', + /* translators: accessibility text */ + __( '(opens in a new tab)' ) + ), + '' + ); + ?> +

+ +


- - post_mime_type, 0, 5 ) ) : ?> -

-
- -

- - 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' ); $editor_args = array( @@ -3037,11 +3051,11 @@ function edit_form_image_editor( $post ) { ?> post_content, 'attachment_content', $editor_args ); ?>