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
Assignees
Labels
area: cdk/drag-drop P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@lukejack
Copy link

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
@lukejack lukejack added the needs triage This issue needs to be triaged by the team label Jul 21, 2020
@crisbeto
Copy link
Member

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

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

@crisbeto
Copy link
Member

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 crisbeto added area: cdk/drag-drop has pr P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed needs triage This issue needs to be triaged by the team labels 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 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.

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

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 pushed 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.
Labels
area: cdk/drag-drop P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants