Accessibility: Themes: use `aria-current` for the `Walker_Nav_Menu` 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 `aria-current` after [42440], [41683], [41359], and [41371]. Props williampatton, chetan200891, sami.keijonen. Fixes #43191. Built from https://develop.svn.wordpress.org/trunk@42808 git-svn-id: http://core.svn.wordpress.org/trunk@42638 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
48077799d9
commit
320a05019a
|
@ -174,6 +174,7 @@ class Walker_Nav_Menu extends Walker {
|
||||||
$atts['target'] = ! empty( $item->target ) ? $item->target : '';
|
$atts['target'] = ! empty( $item->target ) ? $item->target : '';
|
||||||
$atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
|
$atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
|
||||||
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
|
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
|
||||||
|
$atts['aria-current'] = $item->current ? 'page' : '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the HTML attributes applied to a menu item's anchor element.
|
* Filters the HTML attributes applied to a menu item's anchor element.
|
||||||
|
@ -188,6 +189,7 @@ class Walker_Nav_Menu extends Walker {
|
||||||
* @type string $target Target attribute.
|
* @type string $target Target attribute.
|
||||||
* @type string $rel The rel attribute.
|
* @type string $rel The rel attribute.
|
||||||
* @type string $href The href attribute.
|
* @type string $href The href attribute.
|
||||||
|
* @type string $aria_current The aria-current attribute.
|
||||||
* }
|
* }
|
||||||
* @param WP_Post $item The current menu item.
|
* @param WP_Post $item The current menu item.
|
||||||
* @param stdClass $args An object of wp_nav_menu() arguments.
|
* @param stdClass $args An object of wp_nav_menu() arguments.
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.0-alpha-42807';
|
$wp_version = '5.0-alpha-42808';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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