Skip to content

Commit 09622d6

Browse files
authored
fix(replay): Consider more things as DOM mutations for dead clicks (#13518)
Previously, we only considered `Mutation` style changes of rrweb as "DOM mutations" for dead click detection. However, after closer inspection, there are also some other types of changes that we may consider as DOM mutations. By including these we can hopefully reduce some false positives. Not quite sure how to test this 🤔 It's probably also OK to just ship this, as the worst-case scenario is that we have some false-negatives and do not capture certain things, but our general goal here is to be rather on the cautious side, so I think that is acceptable. Possibly fixes #9755
1 parent 03d67c9 commit 09622d6

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.size-limit.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = [
2222
path: 'packages/browser/build/npm/esm/index.js',
2323
import: createImport('init', 'browserTracingIntegration', 'replayIntegration'),
2424
gzip: true,
25-
limit: '73 KB',
25+
limit: '75 KB',
2626
},
2727
{
2828
name: '@sentry/browser (incl. Tracing, Replay) - with treeshaking flags',

packages/replay-internal/src/coreHandlers/handleClick.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ type IncrementalMouseInteractionRecordingEvent = IncrementalRecordingEvent & {
4040
data: { type: MouseInteractions; id: number };
4141
};
4242

43+
/** Any IncrementalSource for rrweb that we interpret as a kind of mutation. */
44+
const IncrementalMutationSources = new Set([
45+
IncrementalSource.Mutation,
46+
IncrementalSource.StyleSheetRule,
47+
IncrementalSource.StyleDeclaration,
48+
IncrementalSource.AdoptedStyleSheet,
49+
IncrementalSource.CanvasMutation,
50+
IncrementalSource.Selection,
51+
IncrementalSource.MediaInteraction,
52+
]);
53+
4354
/** Handle a click. */
4455
export function handleClick(clickDetector: ReplayClickDetector, clickBreadcrumb: Breadcrumb, node: HTMLElement): void {
4556
clickDetector.handleClick(clickBreadcrumb, node);
@@ -324,7 +335,7 @@ export function updateClickDetectorForRecordingEvent(clickDetector: ReplayClickD
324335
}
325336

326337
const { source } = event.data;
327-
if (source === IncrementalSource.Mutation) {
338+
if (IncrementalMutationSources.has(source)) {
328339
clickDetector.registerMutation(event.timestamp);
329340
}
330341

0 commit comments

Comments
 (0)