From 5a80e2e3a2f5c7a43604a3c35cdbb95df8e3a733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Zugmeyer?= Date: Mon, 6 Feb 2023 10:25:36 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A9=F0=9F=90=9B=20enable=20fix=20#1979?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../action/trackClickActions.spec.ts | 36 +++++++------------ .../action/trackClickActions.ts | 24 ++++++------- 2 files changed, 24 insertions(+), 36 deletions(-) diff --git a/packages/rum-core/src/domain/rumEventsCollection/action/trackClickActions.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/action/trackClickActions.spec.ts index b82e452a07..d644fb126e 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/action/trackClickActions.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/action/trackClickActions.spec.ts @@ -430,34 +430,24 @@ describe('trackClickActions', () => { expect(events[0].frustrationTypes).toEqual([FrustrationType.DEAD_CLICK]) }) - describe('dead_click_fixes experimental feature', () => { - beforeEach(() => { - updateExperimentalFeatures(['dead_click_fixes']) - }) - - afterEach(() => { - resetExperimentalFeatures() - }) - - it('does not consider a click with activity happening on pointerdown as a dead click', () => { - const { clock } = setupBuilder.build() + it('does not consider a click with activity happening on pointerdown as a dead click', () => { + const { clock } = setupBuilder.build() - emulateClick({ activity: { on: 'pointerdown' } }) + emulateClick({ activity: { on: 'pointerdown' } }) - clock.tick(EXPIRE_DELAY) - expect(events.length).toBe(1) - expect(events[0].frustrationTypes).toEqual([]) - }) + clock.tick(EXPIRE_DELAY) + expect(events.length).toBe(1) + expect(events[0].frustrationTypes).toEqual([]) + }) - it('activity happening on pointerdown is not taken into account for the action duration', () => { - const { clock } = setupBuilder.build() + it('activity happening on pointerdown is not taken into account for the action duration', () => { + const { clock } = setupBuilder.build() - emulateClick({ activity: { on: 'pointerdown' } }) + emulateClick({ activity: { on: 'pointerdown' } }) - clock.tick(EXPIRE_DELAY) - expect(events.length).toBe(1) - expect(events[0].duration).toBe(0 as Duration) - }) + clock.tick(EXPIRE_DELAY) + expect(events.length).toBe(1) + expect(events[0].duration).toBe(0 as Duration) }) it('does not consider a click with activity happening on pointerup as a dead click', () => { diff --git a/packages/rum-core/src/domain/rumEventsCollection/action/trackClickActions.ts b/packages/rum-core/src/domain/rumEventsCollection/action/trackClickActions.ts index fa1bbc1747..cc4bc8e54b 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/action/trackClickActions.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/action/trackClickActions.ts @@ -151,19 +151,17 @@ function processPointerDown( let hadActivityOnPointerDown = false - if (isExperimentalFeatureEnabled('dead_click_fixes')) { - waitPageActivityEnd( - lifeCycle, - domMutationObservable, - configuration, - (pageActivityEndEvent) => { - hadActivityOnPointerDown = pageActivityEndEvent.hadActivity - }, - // We don't care about the activity duration, we just want to know whether an activity did happen - // within the "validation delay" or not. Limit the duration so the callback is called sooner. - PAGE_ACTIVITY_VALIDATION_DELAY - ) - } + waitPageActivityEnd( + lifeCycle, + domMutationObservable, + configuration, + (pageActivityEndEvent) => { + hadActivityOnPointerDown = pageActivityEndEvent.hadActivity + }, + // We don't care about the activity duration, we just want to know whether an activity did happen + // within the "validation delay" or not. Limit the duration so the callback is called sooner. + PAGE_ACTIVITY_VALIDATION_DELAY + ) return { clickActionBase, hadActivityOnPointerDown: () => hadActivityOnPointerDown } }