Twenty Fourteen: add ARIA attributes to search toggle. See #31527.

Built from https://develop.svn.wordpress.org/trunk@31794


git-svn-id: http://core.svn.wordpress.org/trunk@31776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Lance Willett 2015-03-16 18:51:29 +00:00
parent 0876c26025
commit 913c4cd69c
3 changed files with 10 additions and 3 deletions

View File

@ -45,7 +45,7 @@
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<div class="search-toggle">
<a href="#search-container" class="screen-reader-text"><?php _e( 'Search', 'twentyfourteen' ); ?></a>
<a href="#search-container" class="screen-reader-text" aria-expanded="false" aria-controls="search-container"><?php _e( 'Search', 'twentyfourteen' ); ?></a>
</div>
<nav id="primary-navigation" class="site-navigation primary-navigation" role="navigation">

View File

@ -69,11 +69,18 @@
// Search toggle.
$( '.search-toggle' ).on( 'click.twentyfourteen', function( event ) {
var that = $( this ),
wrapper = $( '.search-box-wrapper' );
wrapper = $( '#search-container' ),
container = that.find( 'a' );
that.toggleClass( 'active' );
wrapper.toggleClass( 'hide' );
if ( that.hasClass( 'active' ) ) {
container.attr( 'aria-expanded', 'true' );
} else {
container.attr( 'aria-expanded', 'false' );
}
if ( that.is( '.active' ) || $( '.search-toggle .screen-reader-text' )[0] === event.target ) {
wrapper.find( '.search-field' ).focus();
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-beta1-31793';
$wp_version = '4.2-beta1-31794';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.