Toolbar: Allow 0 as a value for the `tabindex` property of a menu item.
To enhance accessibility for items without a link you can now define `tabindex="0"`, which makes descendant dropdowns accessible. Props joedolson, afercia, ocean90. Fixes #32495. Built from https://develop.svn.wordpress.org/trunk@38035 git-svn-id: http://core.svn.wordpress.org/trunk@37976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
70fa27a953
commit
f160f2afd1
|
@ -477,8 +477,9 @@ class WP_Admin_Bar {
|
||||||
$is_parent = ! empty( $node->children );
|
$is_parent = ! empty( $node->children );
|
||||||
$has_link = ! empty( $node->href );
|
$has_link = ! empty( $node->href );
|
||||||
|
|
||||||
$tabindex = isset( $node->meta['tabindex'] ) ? (int) $node->meta['tabindex'] : '';
|
// Allow only numeric values, then casted to integers, and allow a tabindex value of `0` for a11y.
|
||||||
$aria_attributes = $tabindex ? 'tabindex="' . $tabindex . '"' : '';
|
$tabindex = ( isset( $node->meta['tabindex'] ) && is_numeric( $node->meta['tabindex'] ) ) ? (int) $node->meta['tabindex'] : '';
|
||||||
|
$aria_attributes = ( '' !== $tabindex ) ? ' tabindex="' . $tabindex . '"' : '';
|
||||||
|
|
||||||
$menuclass = '';
|
$menuclass = '';
|
||||||
|
|
||||||
|
@ -497,7 +498,7 @@ class WP_Admin_Bar {
|
||||||
|
|
||||||
<li id="<?php echo esc_attr( 'wp-admin-bar-' . $node->id ); ?>"<?php echo $menuclass; ?>><?php
|
<li id="<?php echo esc_attr( 'wp-admin-bar-' . $node->id ); ?>"<?php echo $menuclass; ?>><?php
|
||||||
if ( $has_link ):
|
if ( $has_link ):
|
||||||
?><a class="ab-item" <?php echo $aria_attributes; ?> href="<?php echo esc_url( $node->href ) ?>"<?php
|
?><a class="ab-item"<?php echo $aria_attributes; ?> href="<?php echo esc_url( $node->href ) ?>"<?php
|
||||||
if ( ! empty( $node->meta['onclick'] ) ) :
|
if ( ! empty( $node->meta['onclick'] ) ) :
|
||||||
?> onclick="<?php echo esc_js( $node->meta['onclick'] ); ?>"<?php
|
?> onclick="<?php echo esc_js( $node->meta['onclick'] ); ?>"<?php
|
||||||
endif;
|
endif;
|
||||||
|
@ -518,7 +519,7 @@ class WP_Admin_Bar {
|
||||||
endif;
|
endif;
|
||||||
?>><?php
|
?>><?php
|
||||||
else:
|
else:
|
||||||
?><div class="ab-item ab-empty-item" <?php echo $aria_attributes;
|
?><div class="ab-item ab-empty-item"<?php echo $aria_attributes;
|
||||||
if ( ! empty( $node->meta['title'] ) ) :
|
if ( ! empty( $node->meta['title'] ) ) :
|
||||||
?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php
|
?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php
|
||||||
endif;
|
endif;
|
||||||
|
|
|
@ -286,6 +286,8 @@ html:lang(he-il) .rtl #wpadminbar * {
|
||||||
#wpadminbar .quicklinks .ab-sub-wrapper .menupop.hover > a,
|
#wpadminbar .quicklinks .ab-sub-wrapper .menupop.hover > a,
|
||||||
#wpadminbar .quicklinks .menupop.hover ul li a:hover,
|
#wpadminbar .quicklinks .menupop.hover ul li a:hover,
|
||||||
#wpadminbar .quicklinks .menupop.hover ul li a:focus,
|
#wpadminbar .quicklinks .menupop.hover ul li a:focus,
|
||||||
|
#wpadminbar .quicklinks .menupop.hover ul li div[tabindex]:hover,
|
||||||
|
#wpadminbar .quicklinks .menupop.hover ul li div[tabindex]:focus,
|
||||||
#wpadminbar.nojs .quicklinks .menupop:hover ul li a:hover,
|
#wpadminbar.nojs .quicklinks .menupop:hover ul li a:hover,
|
||||||
#wpadminbar.nojs .quicklinks .menupop:hover ul li a:focus,
|
#wpadminbar.nojs .quicklinks .menupop:hover ul li a:focus,
|
||||||
#wpadminbar li:hover .ab-icon:before,
|
#wpadminbar li:hover .ab-icon:before,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -286,6 +286,8 @@ html:lang(he-il) .rtl #wpadminbar * {
|
||||||
#wpadminbar .quicklinks .ab-sub-wrapper .menupop.hover > a,
|
#wpadminbar .quicklinks .ab-sub-wrapper .menupop.hover > a,
|
||||||
#wpadminbar .quicklinks .menupop.hover ul li a:hover,
|
#wpadminbar .quicklinks .menupop.hover ul li a:hover,
|
||||||
#wpadminbar .quicklinks .menupop.hover ul li a:focus,
|
#wpadminbar .quicklinks .menupop.hover ul li a:focus,
|
||||||
|
#wpadminbar .quicklinks .menupop.hover ul li div[tabindex]:hover,
|
||||||
|
#wpadminbar .quicklinks .menupop.hover ul li div[tabindex]:focus,
|
||||||
#wpadminbar.nojs .quicklinks .menupop:hover ul li a:hover,
|
#wpadminbar.nojs .quicklinks .menupop:hover ul li a:hover,
|
||||||
#wpadminbar.nojs .quicklinks .menupop:hover ul li a:focus,
|
#wpadminbar.nojs .quicklinks .menupop:hover ul li a:focus,
|
||||||
#wpadminbar li:hover .ab-icon:before,
|
#wpadminbar li:hover .ab-icon:before,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.6-beta2-38034';
|
$wp_version = '4.6-beta2-38035';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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