From 52c7d7581e9a5a890a120b63e3ecdba69c63987a Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Wed, 24 Feb 2016 16:06:05 +0000 Subject: [PATCH] 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 #35392. git-svn-id: https://develop.svn.wordpress.org/trunk@36683 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/css/dashboard.css | 10 +++-- src/wp-admin/css/list-tables.css | 2 +- src/wp-admin/includes/dashboard.php | 58 ++++++++++++++++++++--------- 3 files changed, 49 insertions(+), 21 deletions(-) diff --git a/src/wp-admin/css/dashboard.css b/src/wp-admin/css/dashboard.css index 0d5f6e03d1..7340cb400d 100644 --- a/src/wp-admin/css/dashboard.css +++ b/src/wp-admin/css/dashboard.css @@ -589,7 +589,7 @@ form.initial-form.quickpress-open input#title { #dashboard_activity .comment-meta span.approve:before { content: "\f227"; font: 20px/.5 dashicons; - margin-left: 12px; + margin-left: 5px; vertical-align: middle; position: relative; top: -1px; @@ -693,7 +693,7 @@ form.initial-form.quickpress-open input#title { #activity-widget #the-comment-list .avatar { position: absolute; - top: 13px; + top: 12px; } #activity-widget #the-comment-list .dashboard-comment-wrap { @@ -806,7 +806,11 @@ form.initial-form.quickpress-open input#title { } #activity-widget #latest-comments #the-comment-list .comment-item { - padding: 1em 12px; + /* 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; } #latest-comments #the-comment-list .pingback { diff --git a/src/wp-admin/css/list-tables.css b/src/wp-admin/css/list-tables.css index c0b8d36ed8..d9fa19a7a7 100644 --- a/src/wp-admin/css/list-tables.css +++ b/src/wp-admin/css/list-tables.css @@ -896,7 +896,7 @@ p.pagenav { tr:hover .row-actions, .mobile .row-actions, .row-actions.visible, -div.comment-item:hover .row-actions { +.comment-item:hover .row-actions { position: static; } diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index a0e7ccd100..a73587ae89 100644 --- a/src/wp-admin/includes/dashboard.php +++ b/src/wp-admin/includes/dashboard.php @@ -583,9 +583,10 @@ function wp_dashboard_recent_drafts( $drafts = false ) { function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) { $GLOBALS['comment'] = clone $comment; - if ( $comment->comment_post_ID > 0 && current_user_can( 'edit_post', $comment->comment_post_ID ) ) { + if ( $comment->comment_post_ID > 0 ) { + $comment_post_title = _draft_or_post_title( $comment->comment_post_ID ); - $comment_post_url = get_edit_post_link( $comment->comment_post_ID ); + $comment_post_url = get_the_permalink( $comment->comment_post_ID ); $comment_post_link = "$comment_post_title"; } else { $comment_post_link = ''; @@ -653,10 +654,9 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) { $actions_string .= "$sep$link"; } } - ?> -
> +
  • > @@ -664,24 +664,25 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {

    - ' . get_comment_author_link( $comment ) . '', $comment_post_link, - ' ' . __( '[Pending]' ) . '' + '' . __( '[Pending]' ) . '' ); } else { printf( /* translators: 1: comment author, 2: notification if the comment is pending */ __( 'From %1$s %2$s' ), '' . get_comment_author_link( $comment ) . '', - ' ' . __( '[Pending]' ) . '' + '' . __( '[Pending]' ) . '' ); } - ?> + ?>

    - -

    $type", $comment_post_link ); ?>

    +

    + $type", + $comment_post_link, + '' . __( '[Pending]' ) . '' + ); + } else { + printf( + /* translators: 1: type of comment, 2: notification if the comment is pending */ + _x( '%1$s', 'dashboard' ), + "$type", + '' . __( '[Pending]' ) . '' + ); + } + ?> +

    +

    +
    -
    +
  • '; - echo '

    ' . __( 'Comments' ) . '

    '; + echo '

    ' . __( 'Recent Comments' ) . '

    '; - echo '
    '; + echo '
      '; foreach ( $comments as $comment ) _wp_dashboard_recent_comments_row( $comment ); - echo '
    '; + echo ''; - if ( current_user_can('edit_posts') ) - _get_list_table('WP_Comments_List_Table')->views(); + if ( current_user_can( 'edit_posts' ) ) { + echo '

    ' . __( 'View more comments' ) . '

    '; + _get_list_table( 'WP_Comments_List_Table' )->views(); + } wp_comment_reply( -1, false, 'dashboard', false ); wp_comment_trashnotice();