Make WordPress Core


Ignore:
Timestamp:
09/20/2019 11:40:06 AM (5 years ago)
Author:
afercia
Message:

Accessibility: Bundled Theme: Make the TwentyEleven skip link the first focusable element within the body.

Props poena, williampatton.
Fixes #47891.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyeleven/functions.php

    r46117 r46195  
    913913    }
    914914endif;
     915
     916/**
     917 * Include a skip to content link at the top of the page so that users can bypass the menu.
     918 *
     919 * @since Twenty Eleven 3.4
     920 */
     921function twentyeleven_skip_link() {
     922    echo '<div class="skip-link"><a class="assistive-text" href="#content">' . esc_html__( 'Skip to primary content', 'twentyeleven' ) . '</a></div>';
     923    if ( ! is_singular() ) {
     924        echo '<div class="skip-link"><a class="assistive-text" href="#secondary">' . esc_html__( 'Skip to secondary content', 'twentyeleven' ) . '</a></div>';
     925    }
     926}
     927add_action( 'wp_body_open', 'twentyeleven_skip_link', 5 );
Note: See TracChangeset for help on using the changeset viewer.