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