Make WordPress Core

Ticket #25592: 25592.5.diff

File 25592.5.diff, 2.1 KB (added by lancewillett, 10 years ago)

Better fix for JS focus for search toggle

  • wp-content/themes/twentyfourteen/functions.php

     
    262262                ) );
    263263        }
    264264
    265         wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20131205', true );
     265        wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20131209', true );
    266266}
    267267add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' );
    268268
  • wp-content/themes/twentyfourteen/js/functions.js

     
    6363                        that.toggleClass( 'active' );
    6464                        wrapper.toggleClass( 'hide' );
    6565
    66                         if ( that.is( '.active' ) || $( '.screen-reader-text' ) === event.target ) {
     66                        if ( that.is( '.active' ) || $( '.search-toggle .screen-reader-text' )[0] === event.target ) {
    6767                                wrapper.find( '.search-field' ).focus();
    6868                        }
    6969                } );
  • wp-content/themes/twentyfourteen/rtl.css

     
    9898}
    9999
    100100.search-toggle .screen-reader-text {
    101         right: auto;
    102         left: 0;
     101        right: 0; /* Avoid a horizontal scrollbar when the site has a long menu */
     102        left: auto;
    103103}
    104104
    105105
  • wp-content/themes/twentyfourteen/style.css

     
    878878        margin-top: 14px;
    879879}
    880880
     881.search-toggle .screen-reader-text {
     882        left: 0; /* Avoid a horizontal scrollbar when the site has a long menu */
     883}
     884
    881885.search-box-wrapper {
    882886        -webkit-box-sizing: border-box;
    883887        -moz-box-sizing:    border-box;