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

@@ -231,18 +231,23 @@ class WP_Posts_List_Table extends WP_List_Table {
protected function get_edit_link( $args, $label, $class = '' ) {
$url = add_query_arg( $args, 'edit.php' );
$class_html = '';
$class_html = $aria_current = '';
if ( ! empty( $class ) ) {
$class_html = sprintf(
' class="%s"',
esc_attr( $class )
);
if ( 'current' === $class ) {
$aria_current = ' aria-current="page"';
}
}
return sprintf(
'<a href="%s"%s>%s</a>',
'<a href="%s"%s%s>%s</a>',
esc_url( $url ),
$class_html,
$aria_current,
$label
);
}