Sitelet https://web.archive.org/web/20220322094147im_/https://github.com/angular/components/issues/20056
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(DragDrop): cdkDropListDropped fires from source rather than destination #20056

Closed
lukejack opened this issue Jul 21, 2020 · 4 comments · Fixed by #20057
Closed

bug(DragDrop): cdkDropListDropped fires from source rather than destination #20056

lukejack opened this issue Jul 21, 2020 · 4 comments · Fixed by #20057

Comments

@lukejack
Copy link

@lukejack lukejack commented Jul 21, 2020 •

Reproduction

Stackblitz link:
https://stackblitz.com/edit/angular-ivy-mvaic6

Steps to reproduce:

  1. Create 2 separate cdkDropLists
  2. Put a cdkDrag element in one of the lists
  3. Connect the lists using cdkDropListConnectedTo
  4. On both lists, attach a console.log to cdkDropListDropped, with different logged text for each container
  5. Drag the cdkDrag element from its origin cdkDropList to the other cdkDropList

Expected Behavior

The destination cdkDropList runs the console.log

Actual Behavior

The source cdkDropList runs the console.log

Environment

  • Angular: 10.0.1
  • CDK: 10.0.0, 9.2.4, and 8.2.3
  • Browser(s): Chrome and Edge
@crisbeto
Copy link
Member

@crisbeto crisbeto commented Jul 21, 2020

It's because the lists aren't actually connected, because there's no list with an id of abc. When you drop it over the second list it's being treated as if you dropped it somewhere outside the list. We should have a warning that is logged when the passed in id doesn't point to a list.

@lukejack
Copy link
Author

@lukejack lukejack commented Jul 21, 2020

Thanks for the quick reply, that has solved my issue.

@lukejack lukejack closed this Jul 21, 2020
@crisbeto
Copy link
Member

@crisbeto crisbeto commented Jul 21, 2020

Let's keep the issue open for now, I'll add a warning so it's easier to catch problems like this in the future.

@crisbeto crisbeto reopened this Jul 21, 2020
@crisbeto crisbeto self-assigned this Jul 21, 2020
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 21, 2020
We support connecting two drop lists by their ID, but if the ID is incorrect, we silently ignore it. These changes add a warning so it's easier to debug issues where the ID might be misspelled.

Fixes angular#20056.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 21, 2020
We support connecting two drop lists by their ID, but if the ID is incorrect, we silently ignore it. These changes add a warning so it's easier to debug issues where the ID might be misspelled.

Fixes angular#20056.
wagnermaciel pushed a commit that referenced this issue Jul 24, 2020
We support connecting two drop lists by their ID, but if the ID is incorrect, we silently ignore it. These changes add a warning so it's easier to debug issues where the ID might be misspelled.

Fixes #20056.
wagnermaciel added a commit that referenced this issue Jul 24, 2020
We support connecting two drop lists by their ID, but if the ID is incorrect, we silently ignore it. These changes add a warning so it's easier to debug issues where the ID might be misspelled.

Fixes #20056.

(cherry picked from commit 89b5fa8)
@angular-automatic-lock-bot
Copy link

@angular-automatic-lock-bot angular-automatic-lock-bot bot commented Aug 24, 2020

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Aug 24, 2020
wagnermaciel added a commit to wagnermaciel/components that referenced this issue Jan 14, 2021
…#20057)

We support connecting two drop lists by their ID, but if the ID is incorrect, we silently ignore it. These changes add a warning so it's easier to debug issues where the ID might be misspelled.

Fixes angular#20056.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants