From 57fdda55335b539568393de3df591bb862298612 Mon Sep 17 00:00:00 2001 From: Szymon Porwolik Date: Sat, 29 Nov 2025 13:26:16 +0100 Subject: [PATCH] Another fix for tooltips --- assets/js/sections/bandmap_list.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/assets/js/sections/bandmap_list.js b/assets/js/sections/bandmap_list.js index 7a7c39031..d96e39937 100644 --- a/assets/js/sections/bandmap_list.js +++ b/assets/js/sections/bandmap_list.js @@ -116,6 +116,18 @@ $(function() { let hoverSpotterMarkers = []; let hoverConnectionLines = []; + // ======================================== + // GLOBAL ERROR HANDLING FOR BOOTSTRAP TOOLTIPS + // ======================================== + + // Suppress Bootstrap tooltip _isWithActiveTrigger errors (known bug with dynamic content) + window.addEventListener('error', function(e) { + if (e.message && e.message.includes('_isWithActiveTrigger')) { + e.preventDefault(); + return true; + } + }); + // ======================================== // DATATABLES ERROR HANDLING // ======================================== @@ -151,8 +163,10 @@ $(function() { try { if (typeof bootstrap !== 'undefined' && bootstrap.Tooltip) { const tooltipInstance = bootstrap.Tooltip.getInstance(this); - if (tooltipInstance && typeof tooltipInstance.dispose === 'function') { - tooltipInstance.dispose(); + if (tooltipInstance) { + // Hide first, then dispose - prevents _isWithActiveTrigger errors + try { tooltipInstance.hide(); } catch(e) {} + try { tooltipInstance.dispose(); } catch(e) {} } } } catch (err) { @@ -1372,8 +1386,9 @@ $(function() { try { // Dispose existing tooltip instance if it exists const existingTooltip = bootstrap.Tooltip.getInstance(this); - if (existingTooltip && typeof existingTooltip.dispose === 'function') { - existingTooltip.dispose(); + if (existingTooltip) { + try { existingTooltip.hide(); } catch(e) {} + try { existingTooltip.dispose(); } catch(e) {} } // Create new tooltip instance with proper configuration