From ef1c3e09acfded9e941f85ba51c3b19b454b0641 Mon Sep 17 00:00:00 2001 From: Lance Willett Date: Thu, 5 Dec 2013 21:27:20 +0000 Subject: [PATCH] Twenty Fourteen: fix too-wide search "jump to" link and provide focus on the search input when it's used. Closes #25592. git-svn-id: https://develop.svn.wordpress.org/trunk@26691 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-content/themes/twentyfourteen/functions.php | 2 +- src/wp-content/themes/twentyfourteen/js/functions.js | 4 ++-- src/wp-content/themes/twentyfourteen/style.css | 4 ---- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/wp-content/themes/twentyfourteen/functions.php b/src/wp-content/themes/twentyfourteen/functions.php index e611a213ae..11f13a1acf 100644 --- a/src/wp-content/themes/twentyfourteen/functions.php +++ b/src/wp-content/themes/twentyfourteen/functions.php @@ -262,7 +262,7 @@ function twentyfourteen_scripts() { ) ); } - wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20131203', true ); + wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20131205', true ); } add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' ); diff --git a/src/wp-content/themes/twentyfourteen/js/functions.js b/src/wp-content/themes/twentyfourteen/js/functions.js index 8299945ef4..038545cfe3 100644 --- a/src/wp-content/themes/twentyfourteen/js/functions.js +++ b/src/wp-content/themes/twentyfourteen/js/functions.js @@ -56,14 +56,14 @@ $( function() { // Search toggle. - $( '.search-toggle' ).on( 'click.twentyfourteen', function() { + $( '.search-toggle' ).on( 'click.twentyfourteen', function( event ) { var that = $( this ), wrapper = $( '.search-box-wrapper' ); that.toggleClass( 'active' ); wrapper.toggleClass( 'hide' ); - if ( that.is( '.active' ) ) { + if ( that.is( '.active' ) || $( '.screen-reader-text' ) === event.target ) { wrapper.find( '.search-field' ).focus(); } } ); diff --git a/src/wp-content/themes/twentyfourteen/style.css b/src/wp-content/themes/twentyfourteen/style.css index 7d2b47f7e2..3af426cce9 100644 --- a/src/wp-content/themes/twentyfourteen/style.css +++ b/src/wp-content/themes/twentyfourteen/style.css @@ -903,10 +903,6 @@ span + .edit-link:before, width: 100%; } -.search-toggle .screen-reader-text { - right: 0; /* This makes sure a horizontal scrollbar won't appear */ -} - /** * 5.0 Navigation