From 501340b5db07d0ec1711dccf0a7e4669fde77192 Mon Sep 17 00:00:00 2001 From: Christine Chambers Date: Fri, 1 Feb 2019 14:22:09 -0800 Subject: [PATCH] Fix sticky tooltips on nvd3 vizzes Currently, we attempt to hide the nvd3 tooltips (if any were on screen) before we draw a new viz after rerunning a query. The hiding is done by selecting the first nvtooltip element and setting the opacity to 0. This somtimes leave behind a trail of old tooltips if a tooltip is left behind by this nvd3 bug https://github.com/novus/nvd3/issues/1262. This PR modifies the behavior of how we clean up tooltips between rerun of queries by selecting all nvd3 tooltips and removing them all from the DOM before redrawing nvd3 vizzes. --- superset/assets/src/visualizations/nvd3/utils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/superset/assets/src/visualizations/nvd3/utils.js b/superset/assets/src/visualizations/nvd3/utils.js index 715b19e75..92ac3dd9c 100644 --- a/superset/assets/src/visualizations/nvd3/utils.js +++ b/superset/assets/src/visualizations/nvd3/utils.js @@ -166,9 +166,9 @@ export function generateBubbleTooltipContent({ } export function hideTooltips() { - const target = document.querySelector('.nvtooltip'); - if (target) { - target.style.opacity = 0; + const targets = document.querySelectorAll('.nvtooltip'); + if (targets.length > 0) { + targets.forEach(t => t.remove()); } }