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.

bug:(@angular/cdk/drag-drop): Cannot read property 'clientRect' of undefined

See original GitHub issue

Bug, feature request, or proposal:

BUG: when drag-dropping an item between two connected dropzone, an error occurs randomly

See video and image below

https://streamable.com/nuudt

error

What is the expected behavior?

No error should occur.

What is the current behavior?

An error occurs randomly as soon as an item enters in the dropzone. The (dropped) event happens anyway.

What are the steps to reproduce?

Classic connected dropzones.

My dropzones are not in the same component.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

@angular/cdk”: “^7.0.0-beta.0” “@angular/material”: “^6.4.7” “@angular/core”: “^6.1.6”,

Is there anything else we should know?

The error is located in drag-drop.es5.js.CdkDrop._sortItem (drag-drop.es5.js:1436)

var currentPosition = siblings[currentIndex].clientRect;

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:28 (4 by maintainers)

github_iconTop GitHub Comments

12reactions
crisbetocommented, Sep 16, 2018

Thanks for the reproduction @kanidjar. It looks like the issue was fixed in master already.

6reactions
birjitningombacommented, Nov 17, 2018

@crisbeto I am trying to sort or dragdrop dynamically generated components. The container has the cdkDropList directive while the dynamically components has the cdkDrag directive and I would expect it works, It is simply not working.

[Parent Component that holds a container for the dynamic child component to insert.]

<div (cdkDropListDropped)="drop($event)" class="example-list"  cdkDropList>
    <ng-template   #container  ></ng-template>
</div>

[HTML of the child component that would be inserted in the container.]

<mat-card class="sample-chips" cdkDrag>
	<mat-card-title>{{chipData.chipName}} </mat-card-title>
	<mat-card-content> <b>{{chipData.chipFlavour}}</b> </mat-card-content>
</mat-card>
Read more comments on GitHub >

github_iconTop Results From Across the Web

cdkDropListData drag-drop Angular Material - Stack Overflow
Here I'm getting the error "Cannot read property 'routePoints' of undefined" when dragging item from a list to another
Read more >
Cannot read property 'get' of undefined : r/node - Reddit
This means the client object does not have a property called commands. So client.commands result in undefined (which does not throw an error)....
Read more >
Is there a way to resize using angular material drag and drop ...
import { CdkDragMove } from '@angular/cdk/drag-drop'; ... Cannot read property 'subscribe' of undefined after running npm test (Angular 2 unit testing) ...
Read more >
@angular/material: Versions | Openbase
select: value set through property not being propagated to value accessor (#10246) ... bug fix, schematics: external stylesheets cannot be migrated ...
Read more >
ANGULAR 13 TypeError Cannot read property of undefined
In this tutorial, we will see a most common error faced by the Angular developers named as "TypeError Cannot read property of undefined...
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