Make WordPress Core

Changeset 36172 for trunk


Ignore:
Timestamp:
01/05/2016 02:18:57 PM (9 years ago)
Author:
afercia
Message:

Accessibility: Remove title attributes from the Admin Dashboard.

Uses aria-label and screen-reader-text where appropriate. Also removes
the default title attribute output by privacy_on_link_title, preserving
the ability to use the filter.

Fixes #35049.

Location:
trunk/src/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/dashboard.css

    r35896 r36172  
    271271
    272272#dashboard_right_now li a:before,
    273 #dashboard_right_now li span:before {
     273#dashboard_right_now li > span:before { /* get only the first level span to exclude screen-reader-text in mu-storage */
    274274    content: "\f159"; /* generic icon for items added by CPTs ? */
    275275    padding: 0 5px 0 0;
  • trunk/src/wp-admin/includes/dashboard.php

    r35900 r36172  
    260260        <li class="comment-count"><a href="edit-comments.php"><?php echo $text; ?></a></li>
    261261        <?php
     262        $moderated_comments_count_i18n = number_format_i18n( $num_comm->moderated );
    262263        /* translators: Number of comments in moderation */
    263         $text = sprintf( _nx( '%s in moderation', '%s in moderation', $num_comm->moderated, 'comments' ), number_format_i18n( $num_comm->moderated ) );
     264        $text = sprintf( _nx( '%s in moderation', '%s in moderation', $num_comm->moderated, 'comments' ), $moderated_comments_count_i18n );
     265        /* translators: Number of comments in moderation */
     266        $aria_label = sprintf( _nx( '%s comment in moderation', '%s comments in moderation', $num_comm->moderated, 'comments' ), $moderated_comments_count_i18n );
    264267        ?>
    265268        <li class="comment-mod-count<?php
     
    267270                echo ' hidden';
    268271            }
    269         ?>"><a href="edit-comments.php?comment_status=moderated"><?php echo $text; ?></a></li>
     272        ?>"><a href="edit-comments.php?comment_status=moderated" aria-label="<?php esc_attr_e( $aria_label ); ?>"><?php echo $text; ?></a></li>
    270273        <?php
    271274    }
     
    303306         *
    304307         * @since 3.0.0
     308         * @since 4.5.0 No title attribute output by default.
    305309         *
    306310         * @param string $title Default attribute text.
    307311         */
    308         $title = apply_filters( 'privacy_on_link_title', __( 'Your site is asking search engines not to index its content' ) );
     312        $title = apply_filters( 'privacy_on_link_title', '' );
    309313
    310314        /**
     
    319323         */
    320324        $content = apply_filters( 'privacy_on_link_text' , __( 'Search Engines Discouraged' ) );
    321 
    322         echo "<p><a href='options-reading.php' title='$title'>$content</a></p>";
     325        $title_attr = '' === $title ? '' : " title='$title'";
     326
     327        echo "<p><a href='options-reading.php'$title_attr>$content</a></p>";
    323328    }
    324329    ?>
     
    550555        $title = _draft_or_post_title( $draft->ID );
    551556        echo "<li>\n";
    552         echo '<div class="draft-title"><a href="' . esc_url( $url ) . '" title="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ) . '">' . esc_html( $title ) . '</a>';
     557        /* translators: %s: post title */
     558        echo '<div class="draft-title"><a href="' . esc_url( $url ) . '" aria-label="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ) . '">' . esc_html( $title ) . '</a>';
    553559        echo '<time datetime="' . get_the_time( 'c', $draft ) . '">' . get_the_time( __( 'F j, Y' ), $draft ) . '</time></div>';
    554560        if ( $the_content = wp_trim_words( $draft->post_content, 10 ) ) {
     
    598604        $delete_url = esc_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
    599605
    600         $actions['approve'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
    601         $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
    602         $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__('Edit comment') . "'>". __('Edit') . '</a>';
    603         $actions['reply'] = '<a onclick="window.commentReply && commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" title="'.esc_attr__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
    604         $actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
     606        $actions['approve'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' aria-label='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
     607        $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' aria-label='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
     608        $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' aria-label='" . esc_attr__( 'Edit this comment' ) . "'>". __( 'Edit' ) . '</a>';
     609        $actions['reply'] = '<a onclick="window.commentReply && commentReply.open(\'' . $comment->comment_ID . '\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" aria-label="' . esc_attr__( 'Reply to this comment' ) . '" href="#">' . __( 'Reply' ) . '</a>';
     610        $actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' aria-label='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
    605611
    606612        if ( ! EMPTY_TRASH_DAYS ) {
    607             $actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
     613            $actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' aria-label='" . esc_attr__( 'Delete this comment permanently' ) . "'>" . __( 'Delete Permanently' ) . '</a>';
    608614        } else {
    609             $actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x('Trash', 'verb') . '</a>';
     615            $actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' aria-label='" . esc_attr__( 'Move this comment to the Trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>';
    610616        }
    611617
    612618        if ( '1' === $comment->comment_approved ) {
    613             $actions['view'] = '<a class="comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '">' . __( 'View' ) . '</a>';
     619            $actions['view'] = '<a class="comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '" aria-label="' . esc_attr__( 'View this comment' ) . '">' . __( 'View' ) . '</a>';
    614620        }
    615621
     
    802808            $recent_post_link = current_user_can( 'edit_post', get_the_ID() ) ? get_edit_post_link() : get_permalink();
    803809
    804             /* translators: 1: relative date, 2: time, 3: post edit link or permalink, 4: post title */
    805             $format = __( '<span>%1$s, %2$s</span> <a href="%3$s">%4$s</a>' );
    806             printf( "<li>$format</li>", $relative, get_the_time(), $recent_post_link, _draft_or_post_title() );
     810            /* translators: 1: relative date, 2: time, 3: post edit link or permalink, 4: post title, 5: aria label */
     811            $format = __( '<span>%1$s, %2$s</span> <a href="%3$s" aria-label="%5$s">%4$s</a>' );
     812            $draft_or_post_title = _draft_or_post_title();
     813            printf( "<li>$format</li>",
     814                $relative,
     815                get_the_time(),
     816                $recent_post_link,
     817                $draft_or_post_title,
     818                /* translators: %s: post title */
     819                esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $draft_or_post_title ) )
     820            );
    807821        }
    808822
     
    11881202            continue;
    11891203
    1190         $title = esc_html( $item->get_title() );
     1204        $raw_title = $item->get_title();
    11911205
    11921206        $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&amp;TB_iframe=true&amp;width=600&amp;height=800';
    1193         echo "<li class='dashboard-news-plugin'><span>" . __( 'Popular Plugin' ) . ":</span> <a href='$link' class='dashboard-news-plugin-link'>$title</a>&nbsp;<span>(<a href='$ilink' class='thickbox' title='$title'>" . __( 'Install' ) . "</a>)</span></li>";
     1207        echo '<li class="dashboard-news-plugin"><span>' . __( 'Popular Plugin' ) . ':</span> ' . esc_html( $raw_title ) .
     1208            '&nbsp;<a href="' . $ilink . '" class="thickbox" aria-label="' .
     1209            /* translators: %s: plugin name */
     1210            esc_attr( sprintf( __( 'Install %s' ), $raw_title ) ) . '">(' . __( 'Install' ) . ')</a></li>';
    11941211
    11951212        $feed->__destruct();
     
    12351252            );
    12361253            printf(
    1237                 '<a href="%1$s" title="%2$s">%3$s</a>',
     1254                '<a href="%1$s">%2$s <span class="screen-reader-text">(%3$s)</span></a>',
    12381255                esc_url( admin_url( 'upload.php' ) ),
    1239                 __( 'Manage Uploads' ),
    1240                 $text
     1256                $text,
     1257                __( 'Manage Uploads' )
    12411258            ); ?>
    12421259        </li><li class="storage-count <?php echo $used_class; ?>">
     
    12481265            );
    12491266            printf(
    1250                 '<a href="%1$s" title="%2$s" class="musublink">%3$s</a>',
     1267                '<a href="%1$s" class="musublink">%2$s <span class="screen-reader-text">(%3$s)</span></a>',
    12511268                esc_url( admin_url( 'upload.php' ) ),
    1252                 __( 'Manage Uploads' ),
    1253                 $text
     1269                $text,
     1270                __( 'Manage Uploads' )
    12541271            ); ?>
    12551272        </li>
     
    12921309
    12931310        $notice .= '<p>' . sprintf( __( '<a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a>' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ), esc_url( $browsehappy ) ) . '</p>';
    1294         $notice .= '<p class="hide-if-no-js"><a href="" class="dismiss">' . __( 'Dismiss' ) . '</a></p>';
     1311        $notice .= '<p class="hide-if-no-js"><a href="" class="dismiss" aria-label="' . esc_attr__( 'Dismiss the browser warning panel' ) . '">' . __( 'Dismiss' ) . '</a></p>';
    12951312        $notice .= '<div class="clear"></div>';
    12961313    }
  • trunk/src/wp-admin/index.php

    r33641 r36172  
    107107    <div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>">
    108108        <?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?>
    109         <a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?welcome=0' ) ); ?>"><?php _e( 'Dismiss' ); ?></a>
     109        <a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?welcome=0' ) ); ?>" aria-label="<?php esc_attr_e( 'Dismiss the welcome panel' ); ?>"><?php _e( 'Dismiss' ); ?></a>
    110110        <?php
    111111        /**
Note: See TracChangeset for help on using the changeset viewer.