: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(experiments): Only show one variant tooltip at a time (#103681)
Juraj Majeriked76272eba6b
diff --git a/frontend/src/scenes/experiments/MetricsView/new/MetricRowGroup.tsx b/frontend/src/scenes/experiments/MetricsView/new/MetricRowGroup.tsxindex 0658139c89c0..4db021de8043 100644--- a/frontend/src/scenes/experiments/MetricsView/new/MetricRowGroup.tsx+++ b/frontend/src/scenes/experiments/MetricsView/new/MetricRowGroup.tsx@@ -538,6 +538,14 @@ interface MetricRowGroupProps {showDetailsModal: boolean}+/**+ * Tooltip state is per MetricRowGroup, and a tooltip can outlive the cursor on its+ * close-grace timer. Without coordination, sweeping the cursor across groups shows+ * several tooltips at once. The group that owns the open tooltip registers its close+ * function here, and the next group to open a tooltip calls it first.+ */+let closeOpenTooltip: (() => void) | null = null+export function MetricRowGroup({metric,result,@@ -583,6 +591,7 @@ export function MetricRowGroup({})const tooltipRef = useRef<HTMLDivElement>(null)const tooltipCloseTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)+ const ownsOpenTooltipRef = useRef(false)const colors = useChartColors()const clearTooltipCloseTimer = (): void => {@@ -593,6 +602,10 @@ export function MetricRowGroup({}const hideTooltipState = (): void => {+ if (ownsOpenTooltipRef.current) {+ ownsOpenTooltipRef.current = false+ closeOpenTooltip = null+ }setTooltipState((prev) => ({...prev,isVisible: false,@@ -617,6 +630,10 @@ export function MetricRowGroup({useEffect(() => {return () => {clearTooltipCloseTimer()+ if (ownsOpenTooltipRef.current) {+ ownsOpenTooltipRef.current = false+ closeOpenTooltip = null+ }}}, [])@@ -710,6 +727,11 @@ export function MetricRowGroup({}clearTooltipCloseTimer()+ if (!ownsOpenTooltipRef.current) {+ closeOpenTooltip?.()+ }+ closeOpenTooltip = closeTooltipNow+ ownsOpenTooltipRef.current = trueconst position = calculateTooltipPosition(chartCell, variantResult)setTooltipState({isVisible: true,