Ticket #31527: 31527.twentyfourteen.searchtoggle.2.patch
File 31527.twentyfourteen.searchtoggle.2.patch, 1.7 KB (added by , 10 years ago) |
---|
-
wp-content/themes/twentyfourteen/header.php
45 45 <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1> 46 46 47 47 <div class="search-toggle"> 48 <a href="#search-container" class="screen-reader-text" ><?php _e( 'Search', 'twentyfourteen' ); ?></a>48 <a href="#search-container" class="screen-reader-text" aria-expanded="false" aria-controls="search-container"><?php _e( 'Search', 'twentyfourteen' ); ?></a> 49 49 </div> 50 50 51 51 <nav id="primary-navigation" class="site-navigation primary-navigation" role="navigation"> -
wp-content/themes/twentyfourteen/js/functions.js
69 69 // Search toggle. 70 70 $( '.search-toggle' ).on( 'click.twentyfourteen', function( event ) { 71 71 var that = $( this ), 72 wrapper = $( '.search-box-wrapper' ); 72 wrapper = $( '#search-container' ), 73 container = that.find( 'a' ); 73 74 74 75 that.toggleClass( 'active' ); 75 76 wrapper.toggleClass( 'hide' ); 76 77 78 if ( that.hasClass( 'active' ) ) { 79 container.attr( 'aria-expanded', 'true' ); 80 } else { 81 container.attr( 'aria-expanded', 'false' ); 82 } 83 77 84 if ( that.is( '.active' ) || $( '.search-toggle .screen-reader-text' )[0] === event.target ) { 78 85 wrapper.find( '.search-field' ).focus(); 79 86 }