diff --git a/packages/grafana-ui/src/components/uPlot/plugins/TooltipPlugin2.tsx b/packages/grafana-ui/src/components/uPlot/plugins/TooltipPlugin2.tsx index 7a84afcfbd9..095ccdca520 100644 --- a/packages/grafana-ui/src/components/uPlot/plugins/TooltipPlugin2.tsx +++ b/packages/grafana-ui/src/components/uPlot/plugins/TooltipPlugin2.tsx @@ -404,6 +404,7 @@ export const TooltipPlugin2 = ({ config.addHook('setData', (u) => { yZoomed = false; yDrag = false; + dismiss(); }); // fires on series focus/proximity changes @@ -526,6 +527,10 @@ export const TooltipPlugin2 = ({ return () => { window.removeEventListener('resize', updateWinSize); window.removeEventListener('scroll', onscroll, true); + + // in case this component unmounts while anchored (due to data auto-refresh + re-config) + document.removeEventListener('mousedown', downEventOutside, true); + document.removeEventListener('keydown', downEventOutside, true); }; }, [config]);