diff --git a/packages/rum-core/src/domain/rumEventsCollection/action/computeFrustration.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/action/computeFrustration.spec.ts index 90727a62b7..f47d7d085e 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/action/computeFrustration.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/action/computeFrustration.spec.ts @@ -1,4 +1,4 @@ -import { ONE_SECOND } from '@datadog/browser-core' +import { ONE_SECOND, resetExperimentalFeatures, updateExperimentalFeatures } from '@datadog/browser-core' import { FrustrationType } from '../../../rawRumEvent.types' import type { Clock } from '../../../../../core/test/specHelper' import { mockClock } from '../../../../../core/test/specHelper' @@ -137,10 +137,12 @@ describe('isDead', () => { beforeEach(() => { isolatedDom = createIsolatedDom() + updateExperimentalFeatures(['dead_click_fixes']) }) afterEach(() => { isolatedDom.clear() + resetExperimentalFeatures() }) it('considers as dead when the click has no page activity', () => { @@ -164,6 +166,8 @@ describe('isDead', () => { { element: 'Foo', expected: true }, { element: 'Foo', expected: false }, { element: 'Foobar', expected: false }, + { element: '
Foo bar
', expected: false }, + { element: '
Foobar
', expected: false }, ]) { it(`does not consider as dead when the click target is ${element}`, () => { expect( diff --git a/packages/rum-core/src/domain/rumEventsCollection/action/computeFrustration.ts b/packages/rum-core/src/domain/rumEventsCollection/action/computeFrustration.ts index 4da4391556..af17fcca2b 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/action/computeFrustration.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/action/computeFrustration.ts @@ -1,4 +1,4 @@ -import { elementMatches, ONE_SECOND } from '@datadog/browser-core' +import { elementMatches, isExperimentalFeatureEnabled, ONE_SECOND } from '@datadog/browser-core' import { FrustrationType } from '../../../rawRumEvent.types' import type { Click } from './trackClickActions' @@ -64,5 +64,11 @@ export function isDead(click: Click) { if (click.hasPageActivity || click.getUserActivity().input) { return false } - return !elementMatches(click.event.target, DEAD_CLICK_EXCLUDE_SELECTOR) + return !elementMatches( + click.event.target, + isExperimentalFeatureEnabled('dead_click_fixes') + ? // contenteditable and their descendants don't always trigger meaningful changes when manipulated + `${DEAD_CLICK_EXCLUDE_SELECTOR},[contenteditable],[contenteditable] *` + : DEAD_CLICK_EXCLUDE_SELECTOR + ) }