Skip to content

Commit 90a893a

Browse files
aptlinVadman97
authored andcommitted
fix: remove passive:true from event listener patch (#98)
Removes the `passive:true` option which breaks `preventDefault` for drag and drop in angular. To reproduce, 1. Clone the angular example repo: ```shell git clone [email protected]:aptlin/angular-scratchpad.git rakesh ``` 2. Add ` "dev:rakesh": "yarn turbo run dev --filter rakesh... --filter frontend...",` to `scripts` and `rakesh` to `workspaces` in the highlight package.json 3. Run `yarn dev:rakesh` with and without this change.
1 parent d5c5312 commit 90a893a

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

packages/rrweb-snapshot/src/snapshot.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,14 +1374,14 @@ function snapshot(
13741374
}
13751375
: maskAllInputs;
13761376
const slimDOMOptions: SlimDOMOptions =
1377-
slimDOM === true || slimDOM === 'all'
1377+
slimDOM === true || (slimDOM as unknown) === 'all'
13781378
? // if true: set of sensible options that should not throw away any information
13791379
{
13801380
script: true,
13811381
comment: true,
13821382
headFavicon: true,
13831383
headWhitespace: true,
1384-
headMetaDescKeywords: slimDOM === 'all', // destructive
1384+
headMetaDescKeywords: (slimDOM as unknown) === 'all', // destructive
13851385
headMetaSocial: true,
13861386
headMetaRobots: true,
13871387
headMetaHttpEquiv: true,

packages/rrweb/src/record/observers/canvas/webgl.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,12 @@ function patchGLPrototype(
4848
const result = original.apply(this, args);
4949
saveWebGLVar(result, win, this);
5050
if (
51-
'tagName' in this.canvas &&
52-
!isBlocked(this.canvas, blockClass, blockSelector, true)
51+
'tagName' in this.canvas &&!isBlocked(
52+
this.canvas as HTMLCanvasElement,
53+
blockClass,
54+
blockSelector,
55+
true,
56+
)
5357
) {
5458
const recordArgs = serializeArgs(args, win, this);
5559
const mutation: canvasMutationWithType = {
@@ -58,7 +62,7 @@ function patchGLPrototype(
5862
args: recordArgs,
5963
};
6064
// TODO: this could potentially also be an OffscreenCanvas as well as HTMLCanvasElement
61-
cb(this.canvas, mutation);
65+
cb(this.canvas as HTMLCanvasElement, mutation);
6266
}
6367

6468
return result;

packages/rrweb/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function on(
2323
fn: EventListenerOrEventListenerObject,
2424
target: Document | IWindow = document,
2525
): listenerHandler {
26-
const options = { capture: true, passive: true };
26+
const options = { capture: true };
2727
target.addEventListener(type, fn, options);
2828
return () => target.removeEventListener(type, fn, options);
2929
}

0 commit comments

Comments
 (0)