Make WordPress Core

Changeset 31794


Ignore:
Timestamp:
03/16/2015 06:50:50 PM (9 years ago)
Author:
lancewillett
Message:

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

Location:
trunk/src/wp-content/themes/twentyfourteen
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyfourteen/header.php

    r31784 r31794  
    4646
    4747            <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>
    4949            </div>
    5050
  • trunk/src/wp-content/themes/twentyfourteen/js/functions.js

    r31784 r31794  
    7070        $( '.search-toggle' ).on( 'click.twentyfourteen', function( event ) {
    7171            var that    = $( this ),
    72                 wrapper = $( '.search-box-wrapper' );
     72                wrapper = $( '#search-container' ),
     73                container = that.find( 'a' );
    7374
    7475            that.toggleClass( 'active' );
    7576            wrapper.toggleClass( 'hide' );
     77
     78            if ( that.hasClass( 'active' ) ) {
     79                container.attr( 'aria-expanded', 'true' );
     80            } else {
     81                container.attr( 'aria-expanded', 'false' );
     82            }
    7683
    7784            if ( that.is( '.active' ) || $( '.search-toggle .screen-reader-text' )[0] === event.target ) {
Note: See TracChangeset for help on using the changeset viewer.