Twenty Twelve: make small-screen menu accessible to keyboard commands and voice-driven software by using a focusable button element rather than h3 for the toggle element. Fixes #28224, props rclations.

git-svn-id: https://develop.svn.wordpress.org/trunk@29095 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Lance Willett 2014-07-11 17:46:11 +00:00
parent 93130f6a29
commit b8340bc9bc
4 changed files with 4 additions and 3 deletions

View File

@ -140,7 +140,7 @@ function twentytwelve_scripts_styles() {
wp_enqueue_script( 'comment-reply' );
// Adds JavaScript for handling the navigation menu hide-and-show behavior.
wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array( 'jquery' ), '20140608', true );
wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array( 'jquery' ), '20140711', true );
$font_url = twentytwelve_get_font_url();
if ( ! empty( $font_url ) )

View File

@ -40,7 +40,7 @@
</hgroup>
<nav id="site-navigation" class="main-navigation" role="navigation">
<h3 class="menu-toggle"><?php _e( 'Menu', 'twentytwelve' ); ?></h3>
<button class="menu-toggle"><?php _e( 'Menu', 'twentytwelve' ); ?></button>
<a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentytwelve' ); ?>"><?php _e( 'Skip to content', 'twentytwelve' ); ?></a>
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
</nav><!-- #site-navigation -->

View File

@ -8,7 +8,7 @@
return;
}
button = nav.getElementsByTagName( 'h3' )[0];
button = nav.getElementsByTagName( 'button' )[0];
menu = nav.getElementsByTagName( 'ul' )[0];
if ( ! button ) {
return;

View File

@ -272,6 +272,7 @@ input[disabled] {
cursor: default;
}
.menu-toggle:hover,
.menu-toggle:focus,
button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,