WordPress.org

Make WordPress Core

Changeset 48812


Ignore:
Timestamp:
08/17/2020 02:24:30 PM (4 months ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-admin-bar.php

    r47771 r48812  
    437437        ?>
    438438        <div id="wpadminbar" class="<?php echo $class; ?>">
    439             <?php if ( ! is_admin() ) { ?>
     439            <?php if ( ! is_admin() && ! did_action( 'wp_body_open' ) ) { ?>
    440440                <a class="screen-reader-shortcut" href="#wp-toolbar" tabindex="1"><?php _e( 'Skip to toolbar' ); ?></a>
    441441            <?php } ?>
Note: See TracChangeset for help on using the changeset viewer.