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(cdkDropList): Wrong index for cdkPlaceHolder/cdkDrag after drag/hover other list and going back to original droplist #28919

Open
1 task
PsychoSpike opened this issue Apr 21, 2024 · 2 comments
Labels
area: cdk/drag-drop P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@PsychoSpike
Copy link

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

My apologies if this is a stupid use case, I am trying to use multiple droplists as a base for a patience/solitaire card game as a learning project. There are multiple connected droplists where you can only drag the last item, and drop it in the last position of another container. This works amazing.

However, dragging from a cdkDroplist from the right to another cdkDroplist to the left of it and returning to the original list does not put the cdkPlaceHolder in the original index. Dragging from left to right (and returning to the original list) does?!

Not sure is this is an issue or working as intended.
I think i understand partially why it happens, but don't understand why it does work from left to right.

Reproduction

StackBlitz link: https://stackblitz.com/~/github.com/PsychoSpike/cdkDropListsSortedToBottom
Steps to reproduce:

  1. Pick up an item from the most right list
  2. Drag(not drop) it over a list to the left
  3. Return to the original list

Expected Behavior

The CdkDragPlaceholder and CdkDrag element returns to its original index

Actual Behavior

The CdkDragPlaceholder shows up at the wrong index and the CdkDrag element gets put into index-1 from starting the drag

Environment

  • Angular:
  • CDK/Material:
  • Browser(s):
  • Operating System (e.g. Windows, macOS, Ubuntu):
@PsychoSpike PsychoSpike added the needs triage This issue needs to be triaged by the team label Apr 21, 2024
@PsychoSpike
Copy link
Author

If this i not an issue, please elaborate how i can replicate what happens when dragging an item over a right list. For example, when using the middle list, you can mess up the placeholder by going to the left, but if you drag it over the right container, the drag placeholder is back to its original index.

I think i can then maybe correct the index using the DragEnter of the Droplist, however i can't figure it out.

@PsychoSpike
Copy link
Author

I don't know if bumping this is a good idea, but i recently (almost) finished this learning project and would like to add the URL to the application itself: testsolitaire

Thank you in advance for your time if you could offer some insights.

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: cdk/drag-drop and removed needs triage This issue needs to be triaged by the team labels Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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

No branches or pull requests

2 participants