mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-09 07:00:01 +00:00
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:
parent
0876c26025
commit
913c4cd69c
@ -45,7 +45,7 @@
|
|||||||
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
|
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
|
||||||
|
|
||||||
<div class="search-toggle">
|
<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>
|
</div>
|
||||||
|
|
||||||
<nav id="primary-navigation" class="site-navigation primary-navigation" role="navigation">
|
<nav id="primary-navigation" class="site-navigation primary-navigation" role="navigation">
|
||||||
|
@ -69,11 +69,18 @@
|
|||||||
// Search toggle.
|
// Search toggle.
|
||||||
$( '.search-toggle' ).on( 'click.twentyfourteen', function( event ) {
|
$( '.search-toggle' ).on( 'click.twentyfourteen', function( event ) {
|
||||||
var that = $( this ),
|
var that = $( this ),
|
||||||
wrapper = $( '.search-box-wrapper' );
|
wrapper = $( '#search-container' ),
|
||||||
|
container = that.find( 'a' );
|
||||||
|
|
||||||
that.toggleClass( 'active' );
|
that.toggleClass( 'active' );
|
||||||
wrapper.toggleClass( 'hide' );
|
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 ) {
|
if ( that.is( '.active' ) || $( '.search-toggle .screen-reader-text' )[0] === event.target ) {
|
||||||
wrapper.find( '.search-field' ).focus();
|
wrapper.find( '.search-field' ).focus();
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user