From 3139cbc74b9f1e690c44371bd43ef84ed47653d9 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Wed, 16 Feb 2022 12:41:58 +0100 Subject: [PATCH] Fix history search popover not closing on click outside This is only a partial fix, since the closing event will not be fired when clicking on the central panel --- client/src/ui/search-input.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/client/src/ui/search-input.js b/client/src/ui/search-input.js index 21c36f4e7dd..06acd5ce212 100644 --- a/client/src/ui/search-input.js +++ b/client/src/ui/search-input.js @@ -152,6 +152,18 @@ function searchInput(parentNode, options) { .popover("show"); }); } + // Hack to hide the advanced search popover when clicking outside + $("body").on("click", function (e) { + $('[data-toggle="advSearchPopover"]').each(function () { + if ( + !$(this).is(e.target) && + $(this).has(e.target).length === 0 && + $(".popover").has(e.target).length === 0 + ) { + $(this).popover("hide"); + } + }); + }); // .................................................................... loadingIndicator rendering // a button for clearing the search bar, placed on the right hand side