From d37b45f66ce9416c6bc06074019bb71c2a66f2e4 Mon Sep 17 00:00:00 2001 From: Ruslan Date: Tue, 12 May 2026 16:26:57 +0300 Subject: [PATCH] fix: hide tooltip on mobile/touch, adaptive vendor info bar --- static/css/index.css | 20 ++++++++++++++++++++ static/js/index.js | 27 ++++++++++++++++----------- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/static/css/index.css b/static/css/index.css index bdec004..f0001e1 100644 --- a/static/css/index.css +++ b/static/css/index.css @@ -798,3 +798,23 @@ .vib-link.mont { background: linear-gradient(135deg, #1f4ea3, #3978e0); color: #fff; } .vib-link.site { background: #fff; color: #2a5aaa; border: 1px solid #c8d8f5; } .vib-link:hover { opacity: .82; transform: translateY(-1px); } + + /* ── Mobile: no hover tooltips ── */ + @media (hover: none), (max-width: 768px) { + .vendor-tooltip { display: none !important; } + } + + /* ── Mobile: adaptive vendor info bar ── */ + @media (max-width: 768px) { + .vendor-info-bar { + flex-direction: column; + align-items: stretch; + gap: 12px; + padding: 14px; + } + .vib-logo { + width: 100%; + height: 120px; + } + .vib-logo img { max-height: 90px; } + } diff --git a/static/js/index.js b/static/js/index.js index 30c2f64..861748b 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -26,12 +26,15 @@ let clickAudioCtx = null; - // ── Vendor tooltip ── + // ── Vendor tooltip (desktop / hover-capable devices only) ── + const canHover = window.matchMedia('(hover: hover) and (pointer: fine)').matches; const tooltip = document.createElement('div'); tooltip.className = 'vendor-tooltip'; document.body.appendChild(tooltip); - tooltip.addEventListener('mouseenter', () => { overTooltip = true; clearTimeout(hideTimer); }); - tooltip.addEventListener('mouseleave', () => { overTooltip = false; hideTooltip(); }); + if (canHover) { + tooltip.addEventListener('mouseenter', () => { overTooltip = true; clearTimeout(hideTimer); }); + tooltip.addEventListener('mouseleave', () => { overTooltip = false; hideTooltip(); }); + } let tooltipTimer = null; let hideTimer = null; @@ -211,14 +214,16 @@ if (wasSelected) scrollAfterDeselect(); else scrollToResultsSmooth(); }); - node.addEventListener("mouseenter", () => { - clearTimeout(tooltipTimer); - tooltipTimer = setTimeout(() => showTooltip(node, vendor), 220); - }); - node.addEventListener("mouseleave", () => { - clearTimeout(tooltipTimer); - hideTooltip(); - }); + if (canHover) { + node.addEventListener("mouseenter", () => { + clearTimeout(tooltipTimer); + tooltipTimer = setTimeout(() => showTooltip(node, vendor), 220); + }); + node.addEventListener("mouseleave", () => { + clearTimeout(tooltipTimer); + hideTooltip(); + }); + } el.vendorList.appendChild(node); }