From c1cc9f0742a7da4d88ec47de47f54b3b23702fb8 Mon Sep 17 00:00:00 2001 From: Jessica McKellar Date: Thu, 1 Nov 2012 12:14:33 -0400 Subject: [PATCH] Don't re-focus on the search box after ending the search. (imported from commit 35bffb245ad9dc58b394a1c5228b32db4830f2bd) --- tools/jslint/check-all.js | 1 + zephyr/static/js/hotkey.js | 2 +- zephyr/static/js/search.js | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/jslint/check-all.js b/tools/jslint/check-all.js index aa379097d9..5c35a295a5 100644 --- a/tools/jslint/check-all.js +++ b/tools/jslint/check-all.js @@ -28,6 +28,7 @@ var globals = // search.js + ' search_button_handler something_is_highlighted update_highlight_on_narrow' + + ' initiate_search' // setup.js + ' loading_spinner templates' diff --git a/zephyr/static/js/hotkey.js b/zephyr/static/js/hotkey.js index b0ca697993..1779f45561 100644 --- a/zephyr/static/js/hotkey.js +++ b/zephyr/static/js/hotkey.js @@ -114,7 +114,7 @@ function process_hotkey(code) { respond_to_message("personal"); return process_hotkey; case 47: // '/': initiate search - clear_search(); + initiate_search(); return process_hotkey; case 63: // '?': Show keyboard shortcuts page $('#keyboard-shortcuts').modal('show'); diff --git a/zephyr/static/js/search.js b/zephyr/static/js/search.js index 166d7edc7a..388702ea36 100644 --- a/zephyr/static/js/search.js +++ b/zephyr/static/js/search.js @@ -92,9 +92,13 @@ function clear_search_cache() { cached_term = ""; } +function initiate_search() { + $('#search').val('').focus(); +} + function clear_search() { $('table tr').removeHighlight(); - $('#search').val('').focus(); + $('#search').val(''); clear_search_cache(); }