From 3054d405e6500618731d819089888f7ef1be63e7 Mon Sep 17 00:00:00 2001 From: Lance Willett Date: Tue, 20 Aug 2013 17:46:08 +0000 Subject: [PATCH] Twenty Fourteen: Focus search box on search menu click, props kovshenin for original patch. Fixes #24895. Built from https://develop.svn.wordpress.org/trunk@25064 git-svn-id: http://core.svn.wordpress.org/trunk@25050 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-content/themes/twentyfourteen/functions.php | 2 +- wp-content/themes/twentyfourteen/js/theme.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/wp-content/themes/twentyfourteen/functions.php b/wp-content/themes/twentyfourteen/functions.php index fe8574d49e..7e488aee50 100644 --- a/wp-content/themes/twentyfourteen/functions.php +++ b/wp-content/themes/twentyfourteen/functions.php @@ -213,7 +213,7 @@ function twentyfourteen_scripts() { if ( is_singular() && wp_attachment_is_image() ) wp_enqueue_script( 'twentyfourteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20130402' ); - wp_enqueue_script( 'twentyfourteen-theme', get_template_directory_uri() . '/js/theme.js', array( 'jquery' ), '20130402', true ); + wp_enqueue_script( 'twentyfourteen-theme', get_template_directory_uri() . '/js/theme.js', array( 'jquery' ), '20130820', true ); } add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' ); diff --git a/wp-content/themes/twentyfourteen/js/theme.js b/wp-content/themes/twentyfourteen/js/theme.js index 6d430c46f6..719540d864 100644 --- a/wp-content/themes/twentyfourteen/js/theme.js +++ b/wp-content/themes/twentyfourteen/js/theme.js @@ -43,6 +43,8 @@ if ( $socialLinksToggle.hasClass( 'active' ) ) { $socialLinksToggle.removeClass( 'active' ); } + if ( $( this ).hasClass( 'active' ) ) + $searchBoxWrapper.find( '.search-field' ).focus(); } ); // DOM manupilations for mobile header