question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cdkDragDrop: Logs error to the console in production

See original GitHub issue

What are you trying to do?

I setup the drag drop functionality for angular cdk and everything works fine functionality wise. But it throws this error Unable to preventDefault inside passive event listener invocation. on drag-ref.ts:655. This only happens when actually moving the item, if you are just holding the drag nothing is thrown. This error only appears in production. Any help would be appreciated on this.

What troubleshooting steps have you tried?

  • Tried disabling pointer events when dragging
  • Tried updating to most recent minor version

Reproduction

<div class="scrollable-container" #productsList="cdkDropList" cdkDropList (cdkDropListDropped)="drop($event)">
     <div *ngFor="let product of availableProducts | search : 'name' : productSearch">
         <div
             cdkDrag
             (cdkDragStarted)="dragStart(product)"
             class="product-item"
         >
             <div class="product-list-detail">
                 <h5 class="p-mb-2">{{product.name}}</h5>
                 <span class="product-category">{{product.active ? 'Active' : 'Inactive'}}</span>
             </div>
             <div class="product-list-action">
                 <h6>{{product.price}}</h6>
             </div>
         </div>
     </div>
 </div>```

### Environment

- Angular: 11.0.9
- CDK/Material: 11.2.12 (and 11.0.9).
- Browser(s): Brave, Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu, Windows

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
aftvincommented, Aug 3, 2022

In my case it has something to do with session recorders. I use LogRocket for that purpose, and the error won’t pop up when session recording is disabled.

1reaction
crisbetocommented, Jun 1, 2022

I haven’t had time to look into this yet, but I wanted to note that this is a console.error, not a hard error so users won’t be affected by it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

angular - Type 'Event' is missing the following properties from ...
Simply importing the DragDropModule from '@angular/cdk/drag-drop' into ... example of a distracting error message produced by the compiler ...
Read more >
Angular - How to remove console.logs in production build
Angular tutorial. This is example how remove console. logs in production build0:00 Use case0:40 Solution1:34 Trying to learn pianoAngular ...
Read more >
Hiding console logs / warings and errors in production build in ...
For debugging our angular application the greater part of us compose console. log to see the values of a given item or variable, ......
Read more >
Cdk Drag Drop Index Bug (forked) - StackBlitz
import {CdkDragDrop, moveItemInArray,. transferArrayItem} from '@angular/cdk/ ... drop(event: CdkDragDrop<any>) {. console.log('PREV', `index: ${event.
Read more >
Function implementation is missing or not immediately ...
If you need to do console.log(this.users); in order to see the data in the ... OK } // comment line below and the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found