mirror of
https://github.com/zulip/zulip.git
synced 2026-07-09 21:21:47 +08:00
Make searchbox shrinking idempotent.
The existing code shortens the searchbox each time it receives focus. Unfortunately, this means that if it receives focus twice in a row, it shrinks twice in a row. (For some reason, the '/' hotkey does this). So, instead, make it idempotent -- if we're already shrunk, don't shrink us again. (imported from commit 8179963bbd00822d15d92609d89f572d2de7800c)
This commit is contained in:
parent
5fa0b8d9d0
commit
79abd7cb5c
@ -112,14 +112,16 @@ function clear_search_cache() {
|
||||
}
|
||||
|
||||
exports.focus_search = function () {
|
||||
// Shrink the searchbox to make room for the buttons.
|
||||
var search_query = $('#search_query');
|
||||
var new_width = search_query.width() -
|
||||
$('.search_button').outerWidth(true)*3;
|
||||
search_query.width(new_width);
|
||||
$("#search_arrows").addClass("input-append");
|
||||
$('.search_button').show();
|
||||
disable_search_arrows_if(false, ["up", "down"]);
|
||||
if (!$('.search_button').is(':visible')) {
|
||||
// Shrink the searchbox to make room for the buttons.
|
||||
var search_query = $('#search_query');
|
||||
var new_width = search_query.width() -
|
||||
$('.search_button').outerWidth(true)*3;
|
||||
search_query.width(new_width);
|
||||
$("#search_arrows").addClass("input-append");
|
||||
$('.search_button').show();
|
||||
disable_search_arrows_if(false, ["up", "down"]);
|
||||
}
|
||||
};
|
||||
|
||||
exports.initiate_search = function () {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user