mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-13 05:10:18 +00:00
Accessibility: Add an aria-current attribute to the Media Library switch links.
The `aria-current` attribute is a simple, effective, way to help assistive technology users orientate themselves within a set of items. Props mayanksonawat, afercia. Fixes #48271. git-svn-id: https://develop.svn.wordpress.org/trunk@46746 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -631,12 +631,15 @@ class WP_List_Table {
|
||||
<div class="view-switch">
|
||||
<?php
|
||||
foreach ( $this->modes as $mode => $title ) {
|
||||
$classes = array( 'view-' . $mode );
|
||||
$classes = array( 'view-' . $mode );
|
||||
$aria_current = '';
|
||||
|
||||
if ( $current_mode === $mode ) {
|
||||
$classes[] = 'current';
|
||||
$classes[] = 'current';
|
||||
$aria_current = ' aria-current="page"';
|
||||
}
|
||||
printf(
|
||||
"<a href='%s' class='%s' id='view-switch-$mode'><span class='screen-reader-text'>%s</span></a>\n",
|
||||
"<a href='%s' class='%s' id='view-switch-$mode'$aria_current><span class='screen-reader-text'>%s</span></a>\n",
|
||||
esc_url( add_query_arg( 'mode', $mode ) ),
|
||||
implode( ' ', $classes ),
|
||||
$title
|
||||
|
||||
Reference in New Issue
Block a user