<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[44900] trunk: Accessibility: improve the "URL" and "Alt text" fields in the media modals.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/44900">44900</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/44900","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>afercia</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2019-03-15 10:42:35 +0000 (Fri, 15 Mar 2019)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Accessibility: improve the "URL" and "Alt text" fields in the media modals.

Many users found the attachment URL field confusing: it says "URL" so it may appear like a field meant to paste a URL into.
Also, the Alt text field is the most important one in terms of content, while the Title field needs to be de-emphasized.

- changes the URL field label to "Copy link"
- moves the alt text field to the top as first field 
- avoids to set initial focus on the alt text 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 accordingly
- updates the QUnit index.html file

Props melchoyce, audrasjb, afercia.
Fixes <a href="https://core.trac.wordpress.org/ticket/41612">#41612</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcjsmediaviewsattachmentdetailsjs">trunk/src/js/media/views/attachment/details.js</a></li>
<li><a href="#trunksrcwpincludescssmediaviewscss">trunk/src/wp-includes/css/media-views.css</a></li>
<li><a href="#trunksrcwpincludesmediatemplatephp">trunk/src/wp-includes/media-template.php</a></li>
<li><a href="#trunktestsqunitindexhtml">trunk/tests/qunit/index.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcjsmediaviewsattachmentdetailsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/js/media/views/attachment/details.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/js/media/views/attachment/details.js    2019-03-14 21:09:47 UTC (rev 44899)
+++ trunk/src/js/media/views/attachment/details.js      2019-03-15 10:42:35 UTC (rev 44900)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -42,23 +42,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        rerenderOnModelChange: false
</span><span class="cx" style="display: block; padding: 0 10px">                });
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                this.on( 'ready', this.initialFocus );
</del><span class="cx" style="display: block; padding: 0 10px">                 // Call 'initialize' directly on the parent class.
</span><span class="cx" style="display: block; padding: 0 10px">                Attachment.prototype.initialize.apply( this, arguments );
</span><span class="cx" style="display: block; padding: 0 10px">        },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        initialFocus: function() {
-               if ( ! wp.media.isTouchDevice ) {
-                       /*
-                       Previously focused the first ':input' (the readonly URL text field).
-                       Since the first ':input' is now a button (delete/trash): when pressing
-                       spacebar on an attachment, Firefox fires deleteAttachment/trashAttachment
-                       as soon as focus is moved. Explicitly target the first text field for now.
-                       @todo change initial focus logic, also for accessibility.
-                       */
-                       this.$( 'input[type="text"]' ).eq( 0 ).focus();
-               }
-       },
</del><span class="cx" style="display: block; padding: 0 10px">         /**
</span><span class="cx" style="display: block; padding: 0 10px">         * @param {Object} event
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span></span></pre></div>
<a id="trunksrcwpincludescssmediaviewscss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/css/media-views.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/css/media-views.css 2019-03-14 21:09:47 UTC (rev 44899)
+++ trunk/src/wp-includes/css/media-views.css   2019-03-15 10:42:35 UTC (rev 44900)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -431,7 +431,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> .attachment-details .setting input[type="tel"],
</span><span class="cx" style="display: block; padding: 0 10px"> .attachment-details .setting input[type="url"],
</span><span class="cx" style="display: block; padding: 0 10px"> .attachment-details .setting textarea,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.attachment-details .setting .value {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.attachment-details .setting .value,
+.attachment-details .setting + .description {
</ins><span class="cx" style="display: block; padding: 0 10px">         box-sizing: border-box;
</span><span class="cx" style="display: block; padding: 0 10px">        margin: 1px;
</span><span class="cx" style="display: block; padding: 0 10px">        width: 65%;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -439,11 +440,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> .media-sidebar .setting .value,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.attachment-details .setting .value {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.attachment-details .setting .value,
+.attachment-details .setting + .description {
</ins><span class="cx" style="display: block; padding: 0 10px">         margin: 0 1px;
</span><span class="cx" style="display: block; padding: 0 10px">        text-align: left;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.attachment-details .setting + .description {
+       font-size: 12px;
+       font-style: normal;
+       margin-bottom: 0.5em;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> .media-sidebar .setting textarea,
</span><span class="cx" style="display: block; padding: 0 10px"> .attachment-details .setting textarea,
</span><span class="cx" style="display: block; padding: 0 10px"> .compat-item .field textarea {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2040,6 +2048,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">        clear: both;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.media-embed .setting.has-description {
+       margin-bottom: 5px;
+}
+
+.media-embed .description {
+       clear: both;
+       font-style: normal;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> .image-details .embed-media-settings .setting {
</span><span class="cx" style="display: block; padding: 0 10px">        float: none;
</span><span class="cx" style="display: block; padding: 0 10px">        width: auto;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2069,11 +2086,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> .image-details .embed-media-settings .setting input.link-to-custom,
</span><span class="cx" style="display: block; padding: 0 10px"> .image-details .embed-media-settings .link-target,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.image-details .embed-media-settings .custom-size {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.image-details .embed-media-settings .custom-size,
+.image-details .description {
</ins><span class="cx" style="display: block; padding: 0 10px">         margin-left: 27%;
</span><span class="cx" style="display: block; padding: 0 10px">        width: 70%;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.image-details .description {
+       font-style: normal;
+       margin-top: 0;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> .image-details .embed-media-settings .link-target {
</span><span class="cx" style="display: block; padding: 0 10px">        margin-top: 24px;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpincludesmediatemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/media-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/media-template.php  2019-03-14 21:09:47 UTC (rev 44899)
+++ trunk/src/wp-includes/media-template.php    2019-03-15 10:42:35 UTC (rev 44900)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -161,6 +161,18 @@
</span><span class="cx" style="display: block; padding: 0 10px">        if ( $is_IE && strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 7' ) !== false ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $class .= ' ie7';
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       $alt_text_description = sprintf(
+               /* translators: 1: link start tag, 2: accessibility text, 3: link end tag */
+               __( 'Describe %1$sthe purpose of the image%2$s%3$s. Leave empty if the image is purely decorative.' ),
+               '<a href="' . esc_url( 'https://www.w3.org/WAI/tutorials/images/decision-tree' ) . '" target="_blank" rel="noopener noreferrer">',
+               sprintf(
+                       '<span class="screen-reader-text"> %s</span>',
+                       /* translators: accessibility text */
+                       __( '(opens in a new tab)' )
+               ),
+               '</a>'
+       );
</ins><span class="cx" style="display: block; padding: 0 10px">         ?>
</span><span class="cx" style="display: block; padding: 0 10px">        <!--[if lte IE 8]>
</span><span class="cx" style="display: block; padding: 0 10px">        <style>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -404,11 +416,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        </div>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        <div class="settings">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <label class="setting" data-setting="url">
-                                       <span class="name"><?php _e( 'URL' ); ?></span>
-                                       <input type="text" value="{{ data.url }}" readonly />
-                               </label>
</del><span class="cx" style="display: block; padding: 0 10px">                                 <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                <# if ( 'image' === data.type ) { #>
+                                       <label class="setting" data-setting="alt">
+                                               <span class="name"><?php _e( 'Alternative Text' ); ?></span>
+                                               <input type="text" value="{{ data.alt }}" aria-describedby="alt-text-description" {{ maybeReadOnly }} />
+                                       </label>
+                                       <p class="description" id="alt-text-description"><?php echo $alt_text_description; ?></p>
+                               <# } #>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 <?php if ( post_type_supports( 'attachment', 'title' ) ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px">                                <label class="setting" data-setting="title">
</span><span class="cx" style="display: block; padding: 0 10px">                                        <span class="name"><?php _e( 'Title' ); ?></span>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -432,12 +447,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        <span class="name"><?php _e( 'Caption' ); ?></span>
</span><span class="cx" style="display: block; padding: 0 10px">                                        <textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea>
</span><span class="cx" style="display: block; padding: 0 10px">                                </label>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <# if ( 'image' === data.type ) { #>
-                                       <label class="setting" data-setting="alt">
-                                               <span class="name"><?php _e( 'Alt Text' ); ?></span>
-                                               <input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} />
-                                       </label>
-                               <# } #>
</del><span class="cx" style="display: block; padding: 0 10px">                                 <label class="setting" data-setting="description">
</span><span class="cx" style="display: block; padding: 0 10px">                                        <span class="name"><?php _e( 'Description' ); ?></span>
</span><span class="cx" style="display: block; padding: 0 10px">                                        <textarea {{ maybeReadOnly }}>{{ data.description }}</textarea>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -456,6 +465,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                <# } #>
</span><span class="cx" style="display: block; padding: 0 10px">                                        </div>
</span><span class="cx" style="display: block; padding: 0 10px">                                <# } #>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                <label class="setting" data-setting="url">
+                                       <span class="name"><?php _e( 'Copy Link' ); ?></span>
+                                       <input type="text" value="{{ data.url }}" readonly />
+                               </label>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 <div class="attachment-compat"></div>
</span><span class="cx" style="display: block; padding: 0 10px">                        </div>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -595,11 +608,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        </div>
</span><span class="cx" style="display: block; padding: 0 10px">                </div>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <label class="setting" data-setting="url">
-                       <span class="name"><?php _e( 'URL' ); ?></span>
-                       <input type="text" value="{{ data.url }}" readonly />
-               </label>
</del><span class="cx" style="display: block; padding: 0 10px">                 <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                <# if ( 'image' === data.type ) { #>
+                       <label class="setting" data-setting="alt">
+                               <span class="name"><?php _e( 'Alt Text' ); ?></span>
+                               <input type="text" value="{{ data.alt }}" aria-describedby="alt-text-description" {{ maybeReadOnly }} />
+                       </label>
+                       <p class="description" id="alt-text-description"><?php echo $alt_text_description; ?></p>
+               <# } #>
</ins><span class="cx" style="display: block; padding: 0 10px">                 <?php if ( post_type_supports( 'attachment', 'title' ) ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px">                <label class="setting" data-setting="title">
</span><span class="cx" style="display: block; padding: 0 10px">                        <span class="name"><?php _e( 'Title' ); ?></span>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -623,16 +639,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        <span class="name"><?php _e( 'Caption' ); ?></span>
</span><span class="cx" style="display: block; padding: 0 10px">                        <textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea>
</span><span class="cx" style="display: block; padding: 0 10px">                </label>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <# if ( 'image' === data.type ) { #>
-                       <label class="setting" data-setting="alt">
-                               <span class="name"><?php _e( 'Alt Text' ); ?></span>
-                               <input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} />
-                       </label>
-               <# } #>
</del><span class="cx" style="display: block; padding: 0 10px">                 <label class="setting" data-setting="description">
</span><span class="cx" style="display: block; padding: 0 10px">                        <span class="name"><?php _e( 'Description' ); ?></span>
</span><span class="cx" style="display: block; padding: 0 10px">                        <textarea {{ maybeReadOnly }}>{{ data.description }}</textarea>
</span><span class="cx" style="display: block; padding: 0 10px">                </label>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                <label class="setting" data-setting="url">
+                       <span class="name"><?php _e( 'Copy Link' ); ?></span>
+                       <input type="text" value="{{ data.url }}" readonly />
+               </label>
</ins><span class="cx" style="display: block; padding: 0 10px">         </script>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        <script type="text/html" id="tmpl-media-selection">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -882,6 +896,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        <img src="{{ data.model.url }}" draggable="false" alt="" />
</span><span class="cx" style="display: block; padding: 0 10px">                </div>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                <label class="setting alt-text has-description">
+                       <span><?php _e( 'Alternative Text' ); ?></span>
+                       <input type="text" data-setting="alt" aria-describedby="alt-text-description" />
+               </label>
+               <p class="description" id="alt-text-description"><?php echo $alt_text_description; ?></p>
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 <?php
</span><span class="cx" style="display: block; padding: 0 10px">                /** This filter is documented in wp-admin/includes/media.php */
</span><span class="cx" style="display: block; padding: 0 10px">                if ( ! apply_filters( 'disable_captions', '' ) ) :
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -892,11 +912,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        </label>
</span><span class="cx" style="display: block; padding: 0 10px">                <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <label class="setting alt-text">
-                       <span><?php _e( 'Alt Text' ); ?></span>
-                       <input type="text" data-setting="alt" />
-               </label>
-
</del><span class="cx" style="display: block; padding: 0 10px">                 <div class="setting align">
</span><span class="cx" style="display: block; padding: 0 10px">                        <span><?php _e( 'Align' ); ?></span>
</span><span class="cx" style="display: block; padding: 0 10px">                        <div class="button-group button-large" data-setting="align">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -948,6 +963,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        </div>
</span><span class="cx" style="display: block; padding: 0 10px">                                </div>
</span><span class="cx" style="display: block; padding: 0 10px">                                <div class="column-settings">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        <label class="setting alt-text has-description">
+                                               <span><?php _e( 'Alternative Text' ); ?></span>
+                                               <input type="text" data-setting="alt" value="{{ data.model.alt }}" aria-describedby="alt-text-description" />
+                                       </label>
+                                       <p class="description" id="alt-text-description"><?php echo $alt_text_description; ?></p>
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                         <?php
</span><span class="cx" style="display: block; padding: 0 10px">                                        /** This filter is documented in wp-admin/includes/media.php */
</span><span class="cx" style="display: block; padding: 0 10px">                                        if ( ! apply_filters( 'disable_captions', '' ) ) :
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -958,11 +979,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                </label>
</span><span class="cx" style="display: block; padding: 0 10px">                                        <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        <label class="setting alt-text">
-                                               <span><?php _e( 'Alternative Text' ); ?></span>
-                                               <input type="text" data-setting="alt" value="{{ data.model.alt }}" />
-                                       </label>
-
</del><span class="cx" style="display: block; padding: 0 10px">                                         <h2><?php _e( 'Display Settings' ); ?></h2>
</span><span class="cx" style="display: block; padding: 0 10px">                                        <div class="setting align">
</span><span class="cx" style="display: block; padding: 0 10px">                                                <span><?php _e( 'Align' ); ?></span>
</span></span></pre></div>
<a id="trunktestsqunitindexhtml"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/qunit/index.html</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/qunit/index.html      2019-03-14 21:09:47 UTC (rev 44899)
+++ trunk/tests/qunit/index.html        2019-03-15 10:42:35 UTC (rev 44900)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1118,12 +1118,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                <div class="file-size"><strong>File size:</strong> {{ data.filesizeHumanReadable }}</div>
</span><span class="cx" style="display: block; padding: 0 10px">                                <# if ( 'image' === data.type && ! data.uploading ) { #>
</span><span class="cx" style="display: block; padding: 0 10px">                                        <# if ( data.width && data.height ) { #>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                <div class="dimensions"><strong>Dimensions:</strong> {{ data.width }} &times; {{ data.height }}</div>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         <div class="dimensions"><strong>Dimensions:</strong>
+                                                       {{ data.width }} by {{ data.height }} pixels                                            </div>
</ins><span class="cx" style="display: block; padding: 0 10px">                                         <# } #>
</span><span class="cx" style="display: block; padding: 0 10px">                                <# } #>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <# if ( data.fileLength ) { #>
-                                       <div class="file-length"><strong>Length:</strong> {{ data.fileLength }}</div>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         <# if ( data.fileLength && data.fileLengthHumanReadable ) { #>
+                                       <div class="file-length"><strong>Length:</strong>
+                                               <span aria-hidden="true">{{ data.fileLength }}</span>
+                                               <span class="screen-reader-text">{{ data.fileLengthHumanReadable }}</span>
+                                       </div>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 <# } #>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                <# if ( 'audio' === data.type && data.meta.bitrate ) { #>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1143,11 +1147,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        </div>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        <div class="settings">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <label class="setting" data-setting="url">
-                                       <span class="name">URL</span>
-                                       <input type="text" value="{{ data.url }}" readonly />
-                               </label>
</del><span class="cx" style="display: block; padding: 0 10px">                                 <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                <# if ( 'image' === data.type ) { #>
+                                       <label class="setting" data-setting="alt">
+                                               <span class="name">Alternative Text</span>
+                                               <input type="text" value="{{ data.alt }}" aria-describedby="alt-text-description" {{ maybeReadOnly }} />
+                                       </label>
+                                       <p class="description" id="alt-text-description">Describe <a href="https://www.w3.org/WAI/tutorials/images/decision-tree" target="_blank" rel="noopener noreferrer">the purpose of the image<span class="screen-reader-text"> (opens in a new tab)</span></a>. Leave empty if the image is purely decorative.</p>
+                               <# } #>
</ins><span class="cx" style="display: block; padding: 0 10px">                                                                 <label class="setting" data-setting="title">
</span><span class="cx" style="display: block; padding: 0 10px">                                        <span class="name">Title</span>
</span><span class="cx" style="display: block; padding: 0 10px">                                        <input type="text" value="{{ data.title }}" {{ maybeReadOnly }} />
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1166,22 +1173,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        <span class="name">Caption</span>
</span><span class="cx" style="display: block; padding: 0 10px">                                        <textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea>
</span><span class="cx" style="display: block; padding: 0 10px">                                </label>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <# if ( 'image' === data.type ) { #>
-                                       <label class="setting" data-setting="alt">
-                                               <span class="name">Alt Text</span>
-                                               <input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} />
-                                       </label>
-                               <# } #>
</del><span class="cx" style="display: block; padding: 0 10px">                                 <label class="setting" data-setting="description">
</span><span class="cx" style="display: block; padding: 0 10px">                                        <span class="name">Description</span>
</span><span class="cx" style="display: block; padding: 0 10px">                                        <textarea {{ maybeReadOnly }}>{{ data.description }}</textarea>
</span><span class="cx" style="display: block; padding: 0 10px">                                </label>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <label class="setting">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         <div class="setting">
</ins><span class="cx" style="display: block; padding: 0 10px">                                         <span class="name">Uploaded By</span>
</span><span class="cx" style="display: block; padding: 0 10px">                                        <span class="value">{{ data.authorName }}</span>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                </label>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         </div>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 <# if ( data.uploadedToTitle ) { #>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        <label class="setting">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 <div class="setting">
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 <span class="name">Uploaded To</span>
</span><span class="cx" style="display: block; padding: 0 10px">                                                <# if ( data.uploadedToLink ) { #>
</span><span class="cx" style="display: block; padding: 0 10px">                                                        <span class="value"><a href="{{ data.uploadedToLink }}">{{ data.uploadedToTitle }}</a></span>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1188,8 +1189,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                <# } else { #>
</span><span class="cx" style="display: block; padding: 0 10px">                                                        <span class="value">{{ data.uploadedToTitle }}</span>
</span><span class="cx" style="display: block; padding: 0 10px">                                                <# } #>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        </label>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 </div>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 <# } #>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                <label class="setting" data-setting="url">
+                                       <span class="name">Copy Link</span>
+                                       <input type="text" value="{{ data.url }}" readonly />
+                               </label>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 <div class="attachment-compat"></div>
</span><span class="cx" style="display: block; padding: 0 10px">                        </div>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1196,7 +1201,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        <div class="actions">
</span><span class="cx" style="display: block; padding: 0 10px">                                <a class="view-attachment" href="{{ data.link }}">View attachment page</a>
</span><span class="cx" style="display: block; padding: 0 10px">                                <# if ( data.can.save ) { #> |
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        <a href="post.php?post={{ data.id }}&action=edit">Edit more details</a>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 <a href="{{ data.editLink }}">Edit more details</a>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 <# } #>
</span><span class="cx" style="display: block; padding: 0 10px">                                <# if ( ! data.uploading && data.can.remove ) { #> |
</span><span class="cx" style="display: block; padding: 0 10px">                                                                                        <button type="button" class="button-link delete-attachment">Delete Permanently</button>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1280,7 +1285,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                <div class="file-size">{{ data.filesizeHumanReadable }}</div>
</span><span class="cx" style="display: block; padding: 0 10px">                                <# if ( 'image' === data.type && ! data.uploading ) { #>
</span><span class="cx" style="display: block; padding: 0 10px">                                        <# if ( data.width && data.height ) { #>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                <div class="dimensions">{{ data.width }} &times; {{ data.height }}</div>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         <div class="dimensions">
+                                                       {{ data.width }} by {{ data.height }} pixels                                            </div>
</ins><span class="cx" style="display: block; padding: 0 10px">                                         <# } #>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                        <# if ( data.can.save && data.sizes ) { #>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1288,8 +1294,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        <# } #>
</span><span class="cx" style="display: block; padding: 0 10px">                                <# } #>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <# if ( data.fileLength ) { #>
-                                       <div class="file-length">Length: {{ data.fileLength }}</div>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         <# if ( data.fileLength && data.fileLengthHumanReadable ) { #>
+                                       <div class="file-length">Length:                                                <span aria-hidden="true">{{ data.fileLength }}</span>
+                                               <span class="screen-reader-text">{{ data.fileLengthHumanReadable }}</span>
+                                       </div>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 <# } #>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                <# if ( ! data.uploading && data.can.remove ) { #>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1304,11 +1312,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        </div>
</span><span class="cx" style="display: block; padding: 0 10px">                </div>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <label class="setting" data-setting="url">
-                       <span class="name">URL</span>
-                       <input type="text" value="{{ data.url }}" readonly />
-               </label>
</del><span class="cx" style="display: block; padding: 0 10px">                 <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                <# if ( 'image' === data.type ) { #>
+                       <label class="setting" data-setting="alt">
+                               <span class="name">Alt Text</span>
+                               <input type="text" value="{{ data.alt }}" aria-describedby="alt-text-description" {{ maybeReadOnly }} />
+                       </label>
+                       <p class="description" id="alt-text-description">Describe <a href="https://www.w3.org/WAI/tutorials/images/decision-tree" target="_blank" rel="noopener noreferrer">the purpose of the image<span class="screen-reader-text"> (opens in a new tab)</span></a>. Leave empty if the image is purely decorative.</p>
+               <# } #>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 <label class="setting" data-setting="title">
</span><span class="cx" style="display: block; padding: 0 10px">                        <span class="name">Title</span>
</span><span class="cx" style="display: block; padding: 0 10px">                        <input type="text" value="{{ data.title }}" {{ maybeReadOnly }} />
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1327,16 +1338,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        <span class="name">Caption</span>
</span><span class="cx" style="display: block; padding: 0 10px">                        <textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea>
</span><span class="cx" style="display: block; padding: 0 10px">                </label>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <# if ( 'image' === data.type ) { #>
-                       <label class="setting" data-setting="alt">
-                               <span class="name">Alt Text</span>
-                               <input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} />
-                       </label>
-               <# } #>
</del><span class="cx" style="display: block; padding: 0 10px">                 <label class="setting" data-setting="description">
</span><span class="cx" style="display: block; padding: 0 10px">                        <span class="name">Description</span>
</span><span class="cx" style="display: block; padding: 0 10px">                        <textarea {{ maybeReadOnly }}>{{ data.description }}</textarea>
</span><span class="cx" style="display: block; padding: 0 10px">                </label>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                <label class="setting" data-setting="url">
+                       <span class="name">Copy Link</span>
+                       <input type="text" value="{{ data.url }}" readonly />
+               </label>
</ins><span class="cx" style="display: block; padding: 0 10px">         </script>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        <script type="text/html" id="tmpl-media-selection">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1597,16 +1606,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        <img src="{{ data.model.url }}" draggable="false" alt="" />
</span><span class="cx" style="display: block; padding: 0 10px">                </div>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                <label class="setting alt-text has-description">
+                       <span>Alternative Text</span>
+                       <input type="text" data-setting="alt" aria-describedby="alt-text-description" />
+               </label>
+               <p class="description" id="alt-text-description">Describe <a href="https://www.w3.org/WAI/tutorials/images/decision-tree" target="_blank" rel="noopener noreferrer">the purpose of the image<span class="screen-reader-text"> (opens in a new tab)</span></a>. Leave empty if the image is purely decorative.</p>
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                         <label class="setting caption">
</span><span class="cx" style="display: block; padding: 0 10px">                                <span>Caption</span>
</span><span class="cx" style="display: block; padding: 0 10px">                                <textarea data-setting="caption" />
</span><span class="cx" style="display: block; padding: 0 10px">                        </label>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <label class="setting alt-text">
-                       <span>Alt Text</span>
-                       <input type="text" data-setting="alt" />
-               </label>
-
</del><span class="cx" style="display: block; padding: 0 10px">                 <div class="setting align">
</span><span class="cx" style="display: block; padding: 0 10px">                        <span>Align</span>
</span><span class="cx" style="display: block; padding: 0 10px">                        <div class="button-group button-large" data-setting="align">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1651,16 +1661,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        </div>
</span><span class="cx" style="display: block; padding: 0 10px">                                </div>
</span><span class="cx" style="display: block; padding: 0 10px">                                <div class="column-settings">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        <label class="setting alt-text has-description">
+                                               <span>Alternative Text</span>
+                                               <input type="text" data-setting="alt" value="{{ data.model.alt }}" aria-describedby="alt-text-description" />
+                                       </label>
+                                       <p class="description" id="alt-text-description">Describe <a href="https://www.w3.org/WAI/tutorials/images/decision-tree" target="_blank" rel="noopener noreferrer">the purpose of the image<span class="screen-reader-text"> (opens in a new tab)</span></a>. Leave empty if the image is purely decorative.</p>
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                                                                         <label class="setting caption">
</span><span class="cx" style="display: block; padding: 0 10px">                                                        <span>Caption</span>
</span><span class="cx" style="display: block; padding: 0 10px">                                                        <textarea data-setting="caption">{{ data.model.caption }}</textarea>
</span><span class="cx" style="display: block; padding: 0 10px">                                                </label>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        <label class="setting alt-text">
-                                               <span>Alternative Text</span>
-                                               <input type="text" data-setting="alt" value="{{ data.model.alt }}" />
-                                       </label>
-
</del><span class="cx" style="display: block; padding: 0 10px">                                         <h2>Display Settings</h2>
</span><span class="cx" style="display: block; padding: 0 10px">                                        <div class="setting align">
</span><span class="cx" style="display: block; padding: 0 10px">                                                <span>Align</span>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1761,7 +1772,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                                </div>
</span><span class="cx" style="display: block; padding: 0 10px">                                                                <label class="setting link-rel">
</span><span class="cx" style="display: block; padding: 0 10px">                                                                        <span>Link Rel</span>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                                        <input type="text" data-setting="linkRel" value="{{ data.model.linkClassName }}" />
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                                 <input type="text" data-setting="linkRel" value="{{ data.model.linkRel }}" />
</ins><span class="cx" style="display: block; padding: 0 10px">                                                                 </label>
</span><span class="cx" style="display: block; padding: 0 10px">                                                                <label class="setting link-class-name">
</span><span class="cx" style="display: block; padding: 0 10px">                                                                        <span>Link CSS Class</span>
</span></span></pre>
</div>
</div>

</body>
</html>