From efe7e75e6f7edaa27caadd4074b3a0c4fa61e7f1 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Wed, 24 Jan 2024 17:01:33 +0100 Subject: fixed preview and filter popup not closing If you're not clicking inside the `#browser` popup, then the preview and filter popups would stay open, until you do so, or something else causes them to close. This fixes that. --- src/app/js/browser.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/js/browser.js b/src/app/js/browser.js index 07572d9..b6e3651 100644 --- a/src/app/js/browser.js +++ b/src/app/js/browser.js @@ -571,12 +571,12 @@ search.addEventListener("keyup", () => { let mouse_events = ["scroll", "mousedown", "touchdown"]; mouse_events.forEach((event) => { - browser.addEventListener(event, () => { + document.body.addEventListener(event, () => { Preview.hide(); - let mouseAt = document.elementsFromPoint(mouseX, mouseY); - if (! mouseAt.includes(document.querySelector("#filter")) - && ! mouseAt.includes(document.querySelector(".overlay"))) { + let mouse_at = document.elementsFromPoint(mouseX, mouseY); + if (! mouse_at.includes(document.querySelector("#filter")) + && ! mouse_at.includes(document.querySelector(".overlay"))) { Browser.filters.toggle(false); } }) -- cgit v1.2.3