Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(experiments): dismiss confidence interval tooltip on scroll (#93580)

Juraj Majerik8ffd85a2a370
diff --git a/frontend/src/scenes/experiments/MetricsView/new/MetricRowGroup.tsx b/frontend/src/scenes/experiments/MetricsView/new/MetricRowGroup.tsx
index 5af7c5635bc3..1e60a00d9d49 100644
--- a/frontend/src/scenes/experiments/MetricsView/new/MetricRowGroup.tsx
+++ b/frontend/src/scenes/experiments/MetricsView/new/MetricRowGroup.tsx
@@ -620,6 +620,22 @@ export function MetricRowGroup({
}
}, [])
+ // The tooltip is fixed-positioned from coordinates captured on hover, so it
+ // doesn't track the page on scroll — dismiss it instead, like native tooltips.
+ useEffect(() => {
+ if (!tooltipState.isVisible) {
+ return
+ }
+ const handleScroll = (): void => {
+ clearTooltipCloseTimer()
+ hideTooltipState()
+ }
+ // Capture phase so scrolls of any ancestor scroll container are caught, not just the window
+ window.addEventListener('scroll', handleScroll, { capture: true, passive: true })
+ return () => window.removeEventListener('scroll', handleScroll, { capture: true })
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [tooltipState.isVisible])
+
const scale = useAxisScale(axisRange, VIEW_BOX_WIDTH, SVG_EDGE_MARGIN)
const { reportExperimentTimeseriesViewed, retryPrimaryMetric, retrySecondaryMetric, refreshExperimentResults } =