From 4d9c4d64aa0266f3928935ada68d91ac81f638aa Mon Sep 17 00:00:00 2001 From: Luis Canada Date: Tue, 20 Aug 2024 18:10:34 -0400 Subject: [PATCH] fix: Slow click on conversion popup does not work --- src/public/script.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/public/script.js b/src/public/script.js index 0a04630..cc14108 100644 --- a/src/public/script.js +++ b/src/public/script.js @@ -41,7 +41,7 @@ const updateSearchBar = () => { const targets = Array.from(targetElements); for (const target of targets) { - target.onclick = () => { + target.onmousedown = () => { convertToElement.value = target.dataset.value; convertToInput.value = `${target.dataset.target} using ${target.dataset.converter}`; showMatching(""); @@ -59,9 +59,7 @@ const updateSearchBar = () => { // Keep the popup open even when clicking on a target button // for a split second to allow the click to go through if (e?.relatedTarget?.classList?.contains("target")) { - setTimeout(() => { - convertToPopup.hidden = true; - }, 100); + convertToPopup.hidden = true; return; }