Accessibility: List Tables: use aria-current for the views current link.

The `aria-current` attribute is a simple, effective way to help assistive
technologies users orientate themselves within a list of items. Continues the 
introduction in core of the `aria-current` attribute after [41359] and [41371].

Props joedolson, flixos90, afercia.
Fixes #32399.


git-svn-id: https://develop.svn.wordpress.org/trunk@41683 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrea Fercia
2017-10-02 19:43:02 +00:00
parent 54153520f2
commit 02588452f7
9 changed files with 56 additions and 31 deletions

View File

@@ -246,7 +246,11 @@ class WP_Comments_List_Table extends WP_List_Table {
$link = add_query_arg( 'comment_type', $comment_type, $link );
foreach ( $stati as $status => $label ) {
$class = ( $status === $comment_status ) ? ' class="current"' : '';
$current_link_attributes = '';
if ( $status === $comment_status ) {
$current_link_attributes = ' class="current" aria-current="page"';
}
if ( !isset( $num_comments->$status ) )
$num_comments->$status = 10;
@@ -258,7 +262,7 @@ class WP_Comments_List_Table extends WP_List_Table {
if ( !empty( $_REQUEST['s'] ) )
$link = add_query_arg( 's', esc_attr( wp_unslash( $_REQUEST['s'] ) ), $link );
*/
$status_links[ $status ] = "<a href='$link'$class>" . sprintf(
$status_links[ $status ] = "<a href='$link'$current_link_attributes>" . sprintf(
translate_nooped_plural( $label, $num_comments->$status ),
sprintf( '<span class="%s-count">%s</span>',
( 'moderated' === $status ) ? 'pending' : $status,