<!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>[36683] trunk/src/wp-admin: Accessibility: improve accessibility of the Dashboard "Recent Comments" widget.</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 { 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/36683">36683</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/36683","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>2016-02-24 16:06:05 +0000 (Wed, 24 Feb 2016)</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 accessibility of the Dashboard "Recent Comments" widget.

- Makes the list of comments a list
- Always displays the title of the post the comment relates to, linked to the post itself and no more to the Edit screen
- Headings: changes the visible one in "Recent Comments" and adds a hidden "View more comments" heading before the views links
- Adds the pending status indicator to Pingbacks and Trackbacks

Props rachelbaker, afercia.

Fixes <a href="https://core.trac.wordpress.org/ticket/35392">#35392</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincssdashboardcss">trunk/src/wp-admin/css/dashboard.css</a></li>
<li><a href="#trunksrcwpadmincsslisttablescss">trunk/src/wp-admin/css/list-tables.css</a></li>
<li><a href="#trunksrcwpadminincludesdashboardphp">trunk/src/wp-admin/includes/dashboard.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadmincssdashboardcss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/css/dashboard.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/css/dashboard.css      2016-02-24 16:05:23 UTC (rev 36682)
+++ trunk/src/wp-admin/css/dashboard.css        2016-02-24 16:06:05 UTC (rev 36683)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -589,7 +589,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> #dashboard_activity .comment-meta span.approve:before {
</span><span class="cx" style="display: block; padding: 0 10px">        content: "\f227";
</span><span class="cx" style="display: block; padding: 0 10px">        font: 20px/.5 dashicons;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        margin-left: 12px;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ margin-left: 5px;
</ins><span class="cx" style="display: block; padding: 0 10px">         vertical-align: middle;
</span><span class="cx" style="display: block; padding: 0 10px">        position: relative;
</span><span class="cx" style="display: block; padding: 0 10px">        top: -1px;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -693,7 +693,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> #activity-widget #the-comment-list .avatar {
</span><span class="cx" style="display: block; padding: 0 10px">        position: absolute;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        top: 13px;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ top: 12px;
</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"> #activity-widget #the-comment-list .dashboard-comment-wrap {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -806,7 +806,11 @@
</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"> #activity-widget #latest-comments #the-comment-list .comment-item {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        padding: 1em 12px;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /* the row-actions paragraph is output only for users with 'edit_comment' capabilities,
+          for other users this needs a min height equal to the gravatar image */
+       min-height: 50px;
+       margin: 0;
+       padding: 12px;
</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"> #latest-comments #the-comment-list .pingback {
</span></span></pre></div>
<a id="trunksrcwpadmincsslisttablescss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/css/list-tables.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/css/list-tables.css    2016-02-24 16:05:23 UTC (rev 36682)
+++ trunk/src/wp-admin/css/list-tables.css      2016-02-24 16:06:05 UTC (rev 36683)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -896,7 +896,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> tr:hover .row-actions,
</span><span class="cx" style="display: block; padding: 0 10px"> .mobile .row-actions,
</span><span class="cx" style="display: block; padding: 0 10px"> .row-actions.visible,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-div.comment-item:hover .row-actions {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.comment-item:hover .row-actions {
</ins><span class="cx" style="display: block; padding: 0 10px">         position: static;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunksrcwpadminincludesdashboardphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/dashboard.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/dashboard.php 2016-02-24 16:05:23 UTC (rev 36682)
+++ trunk/src/wp-admin/includes/dashboard.php   2016-02-24 16:06:05 UTC (rev 36683)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -583,9 +583,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
</span><span class="cx" style="display: block; padding: 0 10px">        $GLOBALS['comment'] = clone $comment;
</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 ( $comment->comment_post_ID > 0 && current_user_can( 'edit_post', $comment->comment_post_ID ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $comment->comment_post_ID > 0 ) {
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $comment_post_title = _draft_or_post_title( $comment->comment_post_ID );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $comment_post_url = get_edit_post_link( $comment->comment_post_ID );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $comment_post_url = get_the_permalink( $comment->comment_post_ID );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>";
</span><span class="cx" style="display: block; padding: 0 10px">        } else {
</span><span class="cx" style="display: block; padding: 0 10px">                $comment_post_link = '';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -653,10 +654,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $actions_string .= "<span class='$action'>$sep$link</span>";
</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">-
</del><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">-                <div id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class( array( 'comment-item', wp_get_comment_status( $comment ) ), $comment ); ?>>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <li id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class( array( 'comment-item', wp_get_comment_status( $comment ) ), $comment ); ?>>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        <?php echo get_avatar( $comment, 50, 'mystery' ); ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -664,24 +664,25 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        <div class="dashboard-comment-wrap has-row-actions">
</span><span class="cx" style="display: block; padding: 0 10px">                        <p class="comment-meta">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <?php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 <?php
+                               // Comments might not have a post they relate to, e.g. programmatically created ones.
</ins><span class="cx" style="display: block; padding: 0 10px">                                 if ( $comment_post_link ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                        printf(
</span><span class="cx" style="display: block; padding: 0 10px">                                                /* translators: 1: comment author, 2: post link, 3: notification if the comment is pending */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                __( 'From %1$s on %2$s%3$s' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         __( 'From %1$s on %2$s %3$s' ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 '<cite class="comment-author">' . get_comment_author_link( $comment ) . '</cite>',
</span><span class="cx" style="display: block; padding: 0 10px">                                                $comment_post_link,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                ' <span class="approve">' . __( '[Pending]' ) . '</span>'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         '<span class="approve">' . __( '[Pending]' ) . '</span>'
</ins><span class="cx" style="display: block; padding: 0 10px">                                         );
</span><span class="cx" style="display: block; padding: 0 10px">                                } else {
</span><span class="cx" style="display: block; padding: 0 10px">                                        printf(
</span><span class="cx" style="display: block; padding: 0 10px">                                                /* translators: 1: comment author, 2: notification if the comment is pending */
</span><span class="cx" style="display: block; padding: 0 10px">                                                __( 'From %1$s %2$s' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                                '<cite class="comment-author">' . get_comment_author_link( $comment ) . '</cite>',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                ' <span class="approve">' . __( '[Pending]' ) . '</span>'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         '<span class="approve">' . __( '[Pending]' ) . '</span>'
</ins><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">-                                ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                         </p>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        <?php
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -699,15 +700,36 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                $type = esc_html( $type );
</span><span class="cx" style="display: block; padding: 0 10px">                        ?>
</span><span class="cx" style="display: block; padding: 0 10px">                        <div class="dashboard-comment-wrap has-row-actions">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        <?php /* translators: %1$s is type of comment, %2$s is link to the post */ ?>
-                       <p class="comment-meta"><?php printf( _x( '%1$s on %2$s', 'dashboard' ), "<strong>$type</strong>", $comment_post_link ); ?></p>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 <p class="comment-meta">
+                       <?php
+                               // Pingbacks, Trackbacks or custom comment types might not have a post they relate to, e.g. programmatically created ones.
+                               if ( $comment_post_link ) {
+                                       printf(
+                                               /* translators: 1: type of comment, 2: post link, 3: notification if the comment is pending */
+                                               _x( '%1$s on %2$s %3$s', 'dashboard' ),
+                                               "<strong>$type</strong>",
+                                               $comment_post_link,
+                                               '<span class="approve">' . __( '[Pending]' ) . '</span>'
+                                       );
+                               } else {
+                                       printf(
+                                               /* translators: 1: type of comment, 2: notification if the comment is pending */
+                                               _x( '%1$s', 'dashboard' ),
+                                               "<strong>$type</strong>",
+                                               '<span class="approve">' . __( '[Pending]' ) . '</span>'
+                                       );
+                               }
+                       ?>
+                       </p>
</ins><span class="cx" style="display: block; padding: 0 10px">                         <p class="comment-author"><?php comment_author_link( $comment ); ?></p>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        <?php endif; // comment_type ?>
</span><span class="cx" style="display: block; padding: 0 10px">                        <blockquote><p><?php comment_excerpt( $comment ); ?></p></blockquote>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        <?php if ( $actions_string ) : ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                         <p class="row-actions"><?php echo $actions_string; ?></p>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        <?php endif; ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                         </div>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                </div>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         </li>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px">        $GLOBALS['comment'] = null;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -877,15 +899,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        if ( $comments ) {
</span><span class="cx" style="display: block; padding: 0 10px">                echo '<div id="latest-comments" class="activity-block">';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                echo '<h3>' . __( 'Comments' ) . '</h3>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         echo '<h3>' . __( 'Recent Comments' ) . '</h3>';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                echo '<div id="the-comment-list" data-wp-lists="list:comment">';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
</ins><span class="cx" style="display: block; padding: 0 10px">                 foreach ( $comments as $comment )
</span><span class="cx" style="display: block; padding: 0 10px">                        _wp_dashboard_recent_comments_row( $comment );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                echo '</div>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         echo '</ul>';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( current_user_can('edit_posts') )
-                       _get_list_table('WP_Comments_List_Table')->views();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( current_user_can( 'edit_posts' ) ) {
+                       echo '<h3 class="screen-reader-text">' . __( 'View more comments' ) . '</h3>';
+                       _get_list_table( 'WP_Comments_List_Table' )->views();
+               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                wp_comment_reply( -1, false, 'dashboard', false );
</span><span class="cx" style="display: block; padding: 0 10px">                wp_comment_trashnotice();
</span></span></pre>
</div>
</div>

</body>
</html>