mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 15:08:10 +01:00
Accessibility: hide admin menu separators from screen readers.
props afercia. fixes #30010. Built from https://develop.svn.wordpress.org/trunk@30393 git-svn-id: http://core.svn.wordpress.org/trunk@30389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d06a94d1e4
commit
ad646bc183
@ -52,6 +52,8 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
|
|||||||
$admin_is_parent = false;
|
$admin_is_parent = false;
|
||||||
$class = array();
|
$class = array();
|
||||||
$aria_attributes = '';
|
$aria_attributes = '';
|
||||||
|
$aria_hidden = '';
|
||||||
|
$is_separator = false;
|
||||||
|
|
||||||
if ( $first ) {
|
if ( $first ) {
|
||||||
$class[] = 'wp-first-item';
|
$class[] = 'wp-first-item';
|
||||||
@ -80,6 +82,10 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
|
|||||||
$img = $img_style = '';
|
$img = $img_style = '';
|
||||||
$img_class = ' dashicons-before';
|
$img_class = ' dashicons-before';
|
||||||
|
|
||||||
|
if ( false !== strpos( $class, 'wp-menu-separator' ) ) {
|
||||||
|
$is_separator = true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the string 'none' (previously 'div') is passed instead of an URL, don't output
|
* If the string 'none' (previously 'div') is passed instead of an URL, don't output
|
||||||
* the default menu image so an icon can be added to div.wp-menu-image as background
|
* the default menu image so an icon can be added to div.wp-menu-image as background
|
||||||
@ -104,9 +110,14 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
|
|||||||
|
|
||||||
$title = wptexturize( $item[0] );
|
$title = wptexturize( $item[0] );
|
||||||
|
|
||||||
echo "\n\t<li$class$id>";
|
// hide separators from screen readers
|
||||||
|
if ( $is_separator ) {
|
||||||
|
$aria_hidden = ' aria-hidden="true"';
|
||||||
|
}
|
||||||
|
|
||||||
if ( false !== strpos( $class, 'wp-menu-separator' ) ) {
|
echo "\n\t<li$class$id$aria_hidden>";
|
||||||
|
|
||||||
|
if ( $is_separator ) {
|
||||||
echo '<div class="separator"></div>';
|
echo '<div class="separator"></div>';
|
||||||
} elseif ( $submenu_as_parent && ! empty( $submenu_items ) ) {
|
} elseif ( $submenu_as_parent && ! empty( $submenu_items ) ) {
|
||||||
$submenu_items = array_values( $submenu_items ); // Re-index.
|
$submenu_items = array_values( $submenu_items ); // Re-index.
|
||||||
|
Loading…
Reference in New Issue
Block a user