Accessibility: Toolbar: Don't output the "Skip to toolbar" link in modern themes that support the `wp_body_open` action.

The links is unnecessary there, as the toolbar is the first thing in the DOM within the `<body>` element.

For themes that don't implement the `wp_body_open` action yet and render the admin bar in the footer, the "Skip to toolbar" link with `tabindex="1"` is still necessary, to ensure it's the first focusable element in the page.

Props sarahricker, afercia, erikjandelange, audrasjb.
Fixes #50702.
Built from https://develop.svn.wordpress.org/trunk@48812


git-svn-id: http://core.svn.wordpress.org/trunk@48574 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-08-17 14:26:07 +00:00
parent fdeba269ca
commit 7d0d6672c4
2 changed files with 2 additions and 2 deletions

View File

@ -436,7 +436,7 @@ class WP_Admin_Bar {
?>
<div id="wpadminbar" class="<?php echo $class; ?>">
<?php if ( ! is_admin() ) { ?>
<?php if ( ! is_admin() && ! did_action( 'wp_body_open' ) ) { ?>
<a class="screen-reader-shortcut" href="#wp-toolbar" tabindex="1"><?php _e( 'Skip to toolbar' ); ?></a>
<?php } ?>
<div class="quicklinks" id="wp-toolbar" role="navigation" aria-label="<?php esc_attr_e( 'Toolbar' ); ?>">

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.6-alpha-48809';
$wp_version = '5.6-alpha-48812';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.