« get me outta code hell

client, css: minor tooltip fixes - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/static/client3.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-11-12 11:34:43 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-11-24 13:45:09 -0400
commit5127fd36dcf5987f402cce0353768b1421d9b7b4 (patch)
tree16840e5b97368a008af717755b020d64e3fc6f4e /src/static/client3.js
parent2d31d6daa66d711a6dc22b84ec0d4b79d776c4ba (diff)
client, css: minor tooltip fixes
Diffstat (limited to 'src/static/client3.js')
-rw-r--r--src/static/client3.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/static/client3.js b/src/static/client3.js
index db9e550..88df58d 100644
--- a/src/static/client3.js
+++ b/src/static/client3.js
@@ -813,6 +813,7 @@ function addHoverableTooltipPageListeners() {
     const {state} = hoverableTooltipInfo;
 
     const hoverables = Array.from(state.registeredHoverables.keys());
+    const tooltips = Array.from(state.registeredTooltips.keys());
 
     const endedTouches = Array.from(domEvent.changedTouches);
 
@@ -825,14 +826,15 @@ function addHoverableTooltipPageListeners() {
 
     if (empty(unbanishedTouches)) return;
 
-    // TODO: https://github.com/tc39/proposal-iterator-helpers
-    const anyTouchOverAnyHoverable =
+    const anyTouchOverAnyHoverableOrTooltip =
       unbanishedTouches.some(({clientX, clientY}) => {
         const element = document.elementFromPoint(clientX, clientY);
-        return hoverables.some(hoverable => hoverable.contains(element));
+        if (hoverables.some(el => el.contains(element))) return true;
+        if (tooltips.some(el => el.contains(element))) return true;
+        return false;
       });
 
-    if (!anyTouchOverAnyHoverable) {
+    if (!anyTouchOverAnyHoverableOrTooltip) {
       hideCurrentlyShownTooltip();
     }
   });