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. Built from https://develop.svn.wordpress.org/trunk@46746 git-svn-id: http://core.svn.wordpress.org/trunk@46546 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
eec579dd86
commit
71725aeb95
|
@ -632,11 +632,14 @@ class WP_List_Table {
|
||||||
<?php
|
<?php
|
||||||
foreach ( $this->modes as $mode => $title ) {
|
foreach ( $this->modes as $mode => $title ) {
|
||||||
$classes = array( 'view-' . $mode );
|
$classes = array( 'view-' . $mode );
|
||||||
|
$aria_current = '';
|
||||||
|
|
||||||
if ( $current_mode === $mode ) {
|
if ( $current_mode === $mode ) {
|
||||||
$classes[] = 'current';
|
$classes[] = 'current';
|
||||||
|
$aria_current = ' aria-current="page"';
|
||||||
}
|
}
|
||||||
printf(
|
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 ) ),
|
esc_url( add_query_arg( 'mode', $mode ) ),
|
||||||
implode( ' ', $classes ),
|
implode( ' ', $classes ),
|
||||||
$title
|
$title
|
||||||
|
|
|
@ -318,7 +318,7 @@ function wp_print_media_templates() {
|
||||||
<a href="<?php echo esc_url( add_query_arg( 'mode', 'list', $_SERVER['REQUEST_URI'] ) ); ?>" class="view-list">
|
<a href="<?php echo esc_url( add_query_arg( 'mode', 'list', $_SERVER['REQUEST_URI'] ) ); ?>" class="view-list">
|
||||||
<span class="screen-reader-text"><?php _e( 'List View' ); ?></span>
|
<span class="screen-reader-text"><?php _e( 'List View' ); ?></span>
|
||||||
</a>
|
</a>
|
||||||
<a href="<?php echo esc_url( add_query_arg( 'mode', 'grid', $_SERVER['REQUEST_URI'] ) ); ?>" class="view-grid current">
|
<a href="<?php echo esc_url( add_query_arg( 'mode', 'grid', $_SERVER['REQUEST_URI'] ) ); ?>" class="view-grid current" aria-current="page">
|
||||||
<span class="screen-reader-text"><?php _e( 'Grid View' ); ?></span>
|
<span class="screen-reader-text"><?php _e( 'Grid View' ); ?></span>
|
||||||
</a>
|
</a>
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.4-alpha-46745';
|
$wp_version = '5.4-alpha-46746';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue