Skip to content

Commit ecff85a

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 2b6c139 commit ecff85a

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
@@ -1394,14 +1394,14 @@ function snapshot(
13941394
}
13951395
: maskAllInputs;
13961396
const slimDOMOptions: SlimDOMOptions =
1397-
slimDOM === true || slimDOM === 'all'
1397+
slimDOM === true || (slimDOM as unknown) === 'all'
13981398
? // if true: set of sensible options that should not throw away any information
13991399
{
14001400
script: true,
14011401
comment: true,
14021402
headFavicon: true,
14031403
headWhitespace: true,
1404-
headMetaDescKeywords: slimDOM === 'all', // destructive
1404+
headMetaDescKeywords: (slimDOM as unknown) === 'all', // destructive
14051405
headMetaSocial: true,
14061406
headMetaRobots: true,
14071407
headMetaHttpEquiv: true,

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,12 @@ function patchGLPrototype(
5050
const result = original.apply(this, args);
5151
saveWebGLVar(result, win, this);
5252
if (
53-
'tagName' in this.canvas &&
54-
!isBlocked(this.canvas, blockClass, blockSelector, true)
53+
'tagName' in this.canvas &&!isBlocked(
54+
this.canvas as HTMLCanvasElement,
55+
blockClass,
56+
blockSelector,
57+
true,
58+
)
5559
) {
5660
const recordArgs = serializeArgs(args, win, this);
5761
const mutation: canvasMutationWithType = {
@@ -60,7 +64,7 @@ function patchGLPrototype(
6064
args: recordArgs,
6165
};
6266
// TODO: this could potentially also be an OffscreenCanvas as well as HTMLCanvasElement
63-
cb(this.canvas, mutation);
67+
cb(this.canvas as HTMLCanvasElement, mutation);
6468
}
6569

6670
return result;

packages/rrweb/src/utils.ts

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

0 commit comments

Comments
 (0)