From e5dd25fbd584c2da25caa3c2910629d8580139de Mon Sep 17 00:00:00 2001 From: abaevbog Date: Fri, 15 Mar 2024 03:37:42 -0400 Subject: [PATCH] Fix collections filter not hiding on windows (#3850) On windows, if the cross icon from the collection filter search-textbox is clicked, the 'blur' event fires before the input is cleared, and the filter is never hidden. To make sure that the search field ends up going away, hide it if the field is empty and not focused in input handler. Fixes: #3840 --- chrome/content/zotero/zoteroPane.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index d6e1a42179..e63b52ea51 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -2858,6 +2858,12 @@ var ZoteroPane = new function() this.handleCollectionSearchInput = function () { let collectionsSearchField = document.getElementById("zotero-collections-search"); this.collectionsView.setFilter(collectionsSearchField.value); + // Make sure that the filter ends up being hidden if the value is cleared + // after the blur event fires. This happens on windows on cross icon click. + if (collectionsSearchField.value.length == 0 + && document.activeElement !== collectionsSearchField) { + this.hideCollectionSearch(); + } }