Skip to content

Conversation

@aptlin
Copy link
Contributor

@aptlin aptlin commented Dec 14, 2022

Removes the passive:true option which breaks preventDefault for drag and drop in angular.

To reproduce,

  1. Clone the angular example repo:
# cd into the highlight monorepo
git clone [email protected]:aptlin/angular-scratchpad.git rakesh
  1. Add "dev:rakesh": "yarn turbo run dev --filter rakesh... --filter frontend...", to scripts and rakesh to workspaces in the highlight package.json
  2. Run yarn dev:rakesh with and without this change.

@linear
Copy link

linear bot commented Dec 14, 2022

HIG-2927 [bug] Highlight causes errors with preventDefault

On Fri, Oct 07, 2022 at 1:26 PM, Rakesh Goyal <[email protected]> wrote:

Hey Jay -

We have started using Highlight again but this is creating a bug in our app. We are using angular to build drag and drop functionality and during the drag event it is throwing this error:Unable to preventDefault inside passive event listener.
If we remove Highlight, that error goes away.
We saw someone mention that they faced the same issue with LogRocket as well.
Do you think there can be a fix soon? We are launching our service early next week and would love to launch with Highlight.
thanks

@aptlin aptlin requested a review from Vadman97 December 14, 2022 05:04
Copy link
Member

@Vadman97 Vadman97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow, awesome!

passive - A boolean value that, if true, indicates that the function specified by listener will never call preventDefault(). If a passive listener does call preventDefault(), the user agent will do nothing other than generate a console warning. If not specified, defaults to false – except that in browsers other than Safari and Internet Explorer, defaults to true for the wheel, mousewheel, touchstart and touchmove events. See Improving scrolling performance with passive listeners to learn more.

why is this only a problem in angular? does rrweb somehow wrap the rest of the event listeners that other folks could be adding in their web app, causing them to not be able to call preventDefault? any other possible implications of doing this in other apps?

@aptlin
Copy link
Contributor Author

aptlin commented Dec 14, 2022

The reason for this seems to be that Angular has its own listener for drag/pointermove events with preventDefault inside, which rrweb tries to wrap with these handlers.

Screenshot 2022-12-14 at 10 24 34 AM

@Vadman97 Vadman97 merged commit 3be5935 into master Dec 14, 2022
@aptlin aptlin deleted the sasha/hig-2927-bug-highlight-causes-errors-with branch December 14, 2022 20:27
Vadman97 pushed a commit that referenced this pull request Jan 6, 2023
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.
Vadman97 pushed a commit that referenced this pull request Jan 9, 2023
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.
Vadman97 pushed a commit that referenced this pull request Jan 11, 2023
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.
Vadman97 pushed a commit that referenced this pull request Jan 25, 2023
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.
Vadman97 pushed a commit that referenced this pull request Feb 20, 2023
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.
Vadman97 pushed a commit that referenced this pull request Feb 21, 2023
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.
Vadman97 pushed a commit that referenced this pull request Feb 21, 2023
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.
Vadman97 pushed a commit that referenced this pull request Feb 21, 2023
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.
Vadman97 pushed a commit that referenced this pull request Feb 22, 2023
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.
Vadman97 pushed a commit that referenced this pull request Apr 9, 2023
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.
Vadman97 pushed a commit that referenced this pull request Apr 28, 2023
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.
Vadman97 pushed a commit that referenced this pull request Jan 30, 2024
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.
Vadman97 pushed a commit that referenced this pull request Mar 4, 2024
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.
Vadman97 pushed a commit that referenced this pull request Mar 5, 2024
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.
Vadman97 pushed a commit that referenced this pull request Mar 5, 2024
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.
Vadman97 pushed a commit that referenced this pull request Apr 16, 2024
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.
Vadman97 pushed a commit that referenced this pull request Apr 17, 2024
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.
Vadman97 pushed a commit that referenced this pull request Jun 25, 2024
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.
Vadman97 pushed a commit that referenced this pull request Aug 5, 2024
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.
Vadman97 pushed a commit that referenced this pull request Aug 5, 2024
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.
Vadman97 pushed a commit that referenced this pull request Aug 26, 2024
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.
Vadman97 pushed a commit that referenced this pull request Sep 3, 2024
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.
Vadman97 pushed a commit that referenced this pull request Sep 9, 2024
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.
Vadman97 pushed a commit that referenced this pull request Sep 18, 2024
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.
Vadman97 pushed a commit that referenced this pull request Oct 9, 2024
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.
Vadman97 pushed a commit that referenced this pull request Oct 9, 2024
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.
Vadman97 pushed a commit that referenced this pull request Oct 15, 2024
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.
Vadman97 pushed a commit that referenced this pull request Oct 29, 2024
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.
Vadman97 pushed a commit that referenced this pull request Oct 29, 2024
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.
Vadman97 pushed a commit that referenced this pull request Mar 20, 2025
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.
Vadman97 pushed a commit that referenced this pull request Mar 21, 2025
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants