diff --git a/src/wp-admin/includes/class-wp-comments-list-table.php b/src/wp-admin/includes/class-wp-comments-list-table.php
index 37e65cfc19..f87ce81e2b 100644
--- a/src/wp-admin/includes/class-wp-comments-list-table.php
+++ b/src/wp-admin/includes/class-wp-comments-list-table.php
@@ -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 ] = "" . sprintf(
+ $status_links[ $status ] = "" . sprintf(
translate_nooped_plural( $label, $num_comments->$status ),
sprintf( '%s',
( 'moderated' === $status ) ? 'pending' : $status,
diff --git a/src/wp-admin/includes/class-wp-ms-themes-list-table.php b/src/wp-admin/includes/class-wp-ms-themes-list-table.php
index fc618f0993..c90d6d5d69 100644
--- a/src/wp-admin/includes/class-wp-ms-themes-list-table.php
+++ b/src/wp-admin/includes/class-wp-ms-themes-list-table.php
@@ -306,9 +306,9 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
$url = 'themes.php';
if ( 'search' != $type ) {
- $status_links[$type] = sprintf( "%s",
+ $status_links[$type] = sprintf( "%s",
esc_url( add_query_arg('theme_status', $type, $url) ),
- ( $type === $status ) ? ' class="current"' : '',
+ ( $type === $status ) ? ' class="current" aria-current="page"' : '',
sprintf( $text, number_format_i18n( $count ) )
);
}
diff --git a/src/wp-admin/includes/class-wp-ms-users-list-table.php b/src/wp-admin/includes/class-wp-ms-users-list-table.php
index 9a5fdb952d..86af8becbe 100644
--- a/src/wp-admin/includes/class-wp-ms-users-list-table.php
+++ b/src/wp-admin/includes/class-wp-ms-users-list-table.php
@@ -134,11 +134,11 @@ class WP_MS_Users_List_Table extends WP_List_Table {
$super_admins = get_super_admins();
$total_admins = count( $super_admins );
- $class = $role != 'super' ? ' class="current"' : '';
+ $current_link_attributes = $role !== 'super' ? ' class="current" aria-current="page"' : '';
$role_links = array();
- $role_links['all'] = "" . sprintf( _nx( 'All (%s)', 'All (%s)', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '';
- $class = $role === 'super' ? ' class="current"' : '';
- $role_links['super'] = "" . sprintf( _n( 'Super Admin (%s)', 'Super Admins (%s)', $total_admins ), number_format_i18n( $total_admins ) ) . '';
+ $role_links['all'] = "" . sprintf( _nx( 'All (%s)', 'All (%s)', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '';
+ $current_link_attributes = $role === 'super' ? ' class="current" aria-current="page"' : '';
+ $role_links['super'] = "" . sprintf( _n( 'Super Admin (%s)', 'Super Admins (%s)', $total_admins ), number_format_i18n( $total_admins ) ) . '';
return $role_links;
}
diff --git a/src/wp-admin/includes/class-wp-plugin-install-list-table.php b/src/wp-admin/includes/class-wp-plugin-install-list-table.php
index e82f5c993d..6fecd0ae2f 100644
--- a/src/wp-admin/includes/class-wp-plugin-install-list-table.php
+++ b/src/wp-admin/includes/class-wp-plugin-install-list-table.php
@@ -286,9 +286,9 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
$display_tabs = array();
foreach ( (array) $tabs as $action => $text ) {
- $class = ( $action === $tab ) ? ' current' : '';
+ $current_link_attributes = ( $action === $tab ) ? ' class="current" aria-current="page"' : '';
$href = self_admin_url('plugin-install.php?tab=' . $action);
- $display_tabs['plugin-install-'.$action] = "$text";
+ $display_tabs['plugin-install-'.$action] = "$text";
}
// No longer a real tab.
unset( $display_tabs['plugin-install-upload'] );
diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php
index 565cb4b951..2cc6c77df1 100644
--- a/src/wp-admin/includes/class-wp-plugins-list-table.php
+++ b/src/wp-admin/includes/class-wp-plugins-list-table.php
@@ -432,9 +432,9 @@ class WP_Plugins_List_Table extends WP_List_Table {
}
if ( 'search' !== $type ) {
- $status_links[$type] = sprintf( "%s",
+ $status_links[$type] = sprintf( "%s",
add_query_arg('plugin_status', $type, 'plugins.php'),
- ( $type === $status ) ? ' class="current"' : '',
+ ( $type === $status ) ? ' class="current" aria-current="page"' : '',
sprintf( $text, number_format_i18n( $count ) )
);
}
diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php
index 851511251a..71d7429feb 100644
--- a/src/wp-admin/includes/class-wp-posts-list-table.php
+++ b/src/wp-admin/includes/class-wp-posts-list-table.php
@@ -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(
- '%s',
+ '%s',
esc_url( $url ),
$class_html,
+ $aria_current,
$label
);
}
diff --git a/src/wp-admin/includes/class-wp-theme-install-list-table.php b/src/wp-admin/includes/class-wp-theme-install-list-table.php
index c1cd88d5cb..d02d56b5b8 100644
--- a/src/wp-admin/includes/class-wp-theme-install-list-table.php
+++ b/src/wp-admin/includes/class-wp-theme-install-list-table.php
@@ -170,9 +170,9 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
$display_tabs = array();
foreach ( (array) $tabs as $action => $text ) {
- $class = ( $action === $tab ) ? ' class="current"' : '';
+ $current_link_attributes = ( $action === $tab ) ? ' class="current" aria-current="page"' : '';
$href = self_admin_url('theme-install.php?tab=' . $action);
- $display_tabs['theme-install-'.$action] = "$text";
+ $display_tabs['theme-install-'.$action] = "$text";
}
return $display_tabs;
diff --git a/src/wp-admin/includes/class-wp-users-list-table.php b/src/wp-admin/includes/class-wp-users-list-table.php
index 6825bca5f0..7143d94b3c 100644
--- a/src/wp-admin/includes/class-wp-users-list-table.php
+++ b/src/wp-admin/includes/class-wp-users-list-table.php
@@ -196,23 +196,24 @@ class WP_Users_List_Table extends WP_List_Table {
$avail_roles = array();
}
- $class = empty($role) ? ' class="current"' : '';
+ $current_link_attributes = empty( $role ) ? ' class="current" aria-current="page"' : '';
+
$role_links = array();
if ( $count_users ) {
- $role_links['all'] = "" . sprintf( _nx( 'All (%s)', 'All (%s)', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '';
+ $role_links['all'] = "" . sprintf( _nx( 'All (%s)', 'All (%s)', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '';
} else {
- $role_links['all'] = "" . _x( 'All', 'users' ) . '';
+ $role_links['all'] = "" . _x( 'All', 'users' ) . '';
}
foreach ( $wp_roles->get_names() as $this_role => $name ) {
if ( $count_users && !isset($avail_roles[$this_role]) ) {
continue;
}
- $class = '';
+ $current_link_attributes = '';
if ( $this_role === $role ) {
- $class = ' class="current"';
+ $current_link_attributes = ' class="current" aria-current="page"';
}
$name = translate_user_role( $name );
@@ -220,15 +221,15 @@ class WP_Users_List_Table extends WP_List_Table {
/* translators: User role name with count */
$name = sprintf( __('%1$s (%2$s)'), $name, number_format_i18n( $avail_roles[$this_role] ) );
}
- $role_links[$this_role] = "$name";
+ $role_links[$this_role] = "$name";
}
if ( ! $count_users || ! empty( $avail_roles['none' ] ) ) {
- $class = '';
+ $current_link_attributes = '';
if ( 'none' === $role ) {
- $class = ' class="current"';
+ $current_link_attributes = ' class="current" aria-current="page"';
}
$name = __( 'No role' );
@@ -236,7 +237,7 @@ class WP_Users_List_Table extends WP_List_Table {
/* translators: User role name with count */
$name = sprintf( __('%1$s (%2$s)'), $name, number_format_i18n( $avail_roles['none' ] ) );
}
- $role_links['none'] = "$name";
+ $role_links['none'] = "$name";
}
diff --git a/src/wp-admin/js/theme.js b/src/wp-admin/js/theme.js
index 5f048d1478..0fddbae46d 100644
--- a/src/wp-admin/js/theme.js
+++ b/src/wp-admin/js/theme.js
@@ -1539,7 +1539,10 @@ themes.view.InstallerSearch = themes.view.Search.extend({
request.tag = [ value.slice( 4 ) ];
}
- $( '.filter-links li > a.current' ).removeClass( 'current' );
+ $( '.filter-links li > a.current' )
+ .removeClass( 'current' )
+ .removeAttr( 'aria-current' );
+
$( 'body' ).removeClass( 'show-filters filters-applied show-favorites-form' );
$( '.drawer-toggle' ).attr( 'aria-expanded', 'false' );
@@ -1663,8 +1666,13 @@ themes.view.Installer = themes.view.Appearance.extend({
// Track sorting so we can restore the correct tab when closing preview.
themes.router.selectedTab = sort;
- $( '.filter-links li > a, .theme-filter' ).removeClass( this.activeClass );
- $( '[data-sort="' + sort + '"]' ).addClass( this.activeClass );
+ $( '.filter-links li > a, .theme-filter' )
+ .removeClass( this.activeClass )
+ .removeAttr( 'aria-current' );
+
+ $( '[data-sort="' + sort + '"]' )
+ .addClass( this.activeClass )
+ .attr( 'aria-current', 'page' );
if ( 'favorites' === sort ) {
$( 'body' ).addClass( 'show-favorites-form' );
@@ -1686,8 +1694,12 @@ themes.view.Installer = themes.view.Appearance.extend({
return;
}
- $( '.filter-links li > a, .theme-section' ).removeClass( this.activeClass );
- $el.addClass( this.activeClass );
+ $( '.filter-links li > a, .theme-section' )
+ .removeClass( this.activeClass )
+ .removeAttr( 'aria-current' );
+ $el
+ .addClass( this.activeClass )
+ .attr( 'aria-current', 'page' );
if ( ! filter ) {
return;
@@ -1725,7 +1737,10 @@ themes.view.Installer = themes.view.Appearance.extend({
}
$( 'body' ).addClass( 'filters-applied' );
- $( '.filter-links li > a.current' ).removeClass( 'current' );
+ $( '.filter-links li > a.current' )
+ .removeClass( 'current' )
+ .removeAttr( 'aria-current' );
+
filteringBy.empty();
_.each( tags, function( tag ) {