Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

search: Remove redundant actions on `focus` events.

Ryan Rehmandd4460009b74
diff --git a/static/js/search.js b/static/js/search.js
index 721c1235e00..d987b596c5d 100644
--- a/static/js/search.js
+++ b/static/js/search.js
@@ -176,10 +176,6 @@ exports.initialize = function () {
// Uses jquery instead of pure css as the `:focus` event occurs on `#search_query`,
// while we want to add box-shadow to `#searchbox`. This could have been done
// with `:focus-within` CSS selector, but it is not supported in IE or Opera.
- searchbox.on('focusin', function () {
- tab_bar.open_search_bar_and_close_narrow_description();
- searchbox.css({"box-shadow": "inset 0px 0px 0px 2px hsl(204, 20%, 74%)"});
- });
searchbox.on('focusout', function () {
tab_bar.close_search_bar_and_open_narrow_description();
searchbox.css({"box-shadow": "unset"});
@@ -194,6 +190,7 @@ exports.focus_search = function () {
exports.initiate_search = function () {
tab_bar.open_search_bar_and_close_narrow_description();
+ $('#searchbox').css({"box-shadow": "inset 0px 0px 0px 2px hsl(204, 20%, 74%)"});
$('#search_query').typeahead('lookup').select();
if (page_params.search_pills_enabled) {
$('#search_query').focus();
diff --git a/static/js/tab_bar.js b/static/js/tab_bar.js
index 0c8123a6806..8396343bef8 100644
--- a/static/js/tab_bar.js
+++ b/static/js/tab_bar.js
@@ -71,7 +71,6 @@ function append_and_display_title_area(tab_bar_data) {
function bind_title_area_handlers() {
$(".search_closed").on("click", function (e) {
- exports.open_search_bar_and_close_narrow_description();
search.initiate_search();
e.preventDefault();
e.stopPropagation();
@@ -85,7 +84,6 @@ function bind_title_area_handlers() {
// Let links behave normally, ie, do nothing if <a>
if ($(e.target).closest("a").length === 0) {
- exports.open_search_bar_and_close_narrow_description();
search.initiate_search();
e.preventDefault();
e.stopPropagation();