Twenty Fourteen: make small-screen menu accessible to keyboard commands and voice-driven software by using a focusable button element rather than h1 for the toggle element. Fixes #27147, props jartes and joedolson.

git-svn-id: https://develop.svn.wordpress.org/trunk@27594 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Lance Willett 2014-03-18 22:36:12 +00:00
parent 72c63cd966
commit ce25840560
2 changed files with 16 additions and 2 deletions

View File

@ -49,7 +49,7 @@
</div> </div>
<nav id="primary-navigation" class="site-navigation primary-navigation" role="navigation"> <nav id="primary-navigation" class="site-navigation primary-navigation" role="navigation">
<h1 class="menu-toggle"><?php _e( 'Primary Menu', 'twentyfourteen' ); ?></h1> <button class="menu-toggle"><?php _e( 'Primary Menu', 'twentyfourteen' ); ?></button>
<a class="screen-reader-text skip-link" href="#content"><?php _e( 'Skip to content', 'twentyfourteen' ); ?></a> <a class="screen-reader-text skip-link" href="#content"><?php _e( 'Skip to content', 'twentyfourteen' ); ?></a>
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?> <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
</nav> </nav>

View File

@ -820,7 +820,7 @@ span + .edit-link:before,
*/ */
/* Ensure that there is no gap between the header and /* Ensure that there is no gap between the header and
the admin bar for WordPress versions before 3.8. */ the admin bar for WordPress versions before 3.8. */
#wpadminbar { #wpadminbar {
min-height: 32px; min-height: 32px;
} }
@ -986,11 +986,14 @@ span + .edit-link:before,
} }
.menu-toggle { .menu-toggle {
background-color: #000;
border-radius: 0;
cursor: pointer; cursor: pointer;
font-size: 0; font-size: 0;
height: 48px; height: 48px;
margin: 0; margin: 0;
overflow: hidden; overflow: hidden;
padding: 0;
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
@ -1001,9 +1004,20 @@ span + .edit-link:before,
.menu-toggle:before { .menu-toggle:before {
color: #fff; color: #fff;
content: "\f419"; content: "\f419";
display: inline;
margin-top: 16px; margin-top: 16px;
} }
.menu-toggle:active,
.menu-toggle:focus,
.menu-toggle:hover {
background-color: #444;
}
.menu-toggle:focus {
outline: 1px dotted;
}
/** /**
* 6.0 Content * 6.0 Content