From 2a646dc529edee1e29fef651195713862de71bf0 Mon Sep 17 00:00:00 2001 From: Aymeric Mortemousque Date: Tue, 24 Oct 2023 16:19:16 +0200 Subject: [PATCH] Check if target is connected --- .../src/domain/view/viewMetrics/trackCumulativeLayoutShift.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rum-core/src/domain/view/viewMetrics/trackCumulativeLayoutShift.ts b/packages/rum-core/src/domain/view/viewMetrics/trackCumulativeLayoutShift.ts index d9dc30364e..7ef121b642 100644 --- a/packages/rum-core/src/domain/view/viewMetrics/trackCumulativeLayoutShift.ts +++ b/packages/rum-core/src/domain/view/viewMetrics/trackCumulativeLayoutShift.ts @@ -76,7 +76,7 @@ export function trackCumulativeLayoutShift( if ( isExperimentalFeatureEnabled(ExperimentalFeature.WEB_VITALS_ATTRIBUTION) && clsTarget && - clsTarget.parentElement + clsTarget.isConnected ) { const selectorComputationStart = relativeNow() cslTargetSelector = getSelectorFromElement(clsTarget, configuration.actionNameAttribute)