Skip to content

fix(drag-drop): drop-list wrong enter position #19116

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

Merged
merged 4 commits into from
Apr 29, 2020
Merged

fix(drag-drop): drop-list wrong enter position #19116

merged 4 commits into from
Apr 29, 2020

Conversation

albyrock87
Copy link
Contributor

Parent rect should be cached again when the new item has been added.
issue video

If item is entering from start (left/top) it should be inserted in the first position from the beginning to avoid "jump effect"
issue video

When looking for item index from pointer position exclude right/bottom pixel: that pixel is external.
issue video

Parent rect should be cached again when the new item has been added.
If item is entering from start (left/top) it should be inserted in the first position.
When looking for item index from pointer position exclude right/bottom pixel: that pixel is external.
@albyrock87 albyrock87 requested a review from crisbeto as a code owner April 19, 2020 17:33
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Apr 19, 2020
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes mostly LGTM, but it needs unit tests.

Added unit tests to cover fixed scenarios
@albyrock87 albyrock87 marked this pull request as draft April 27, 2020 14:18
@albyrock87 albyrock87 marked this pull request as ready for review April 27, 2020 16:09
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for the contribution. This is something that has been nagging me, but I haven't had the time to look into it properly 👍 .

@crisbeto crisbeto added lgtm action: merge The PR is ready for merge by the caretaker P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release labels Apr 27, 2020
@albyrock87
Copy link
Contributor Author

You're welcome. This probably fixes some scenarios like #18638 and other related issues. Someone also complains #17736 that "parent rects" are not being "refreshed" when drag starts: a solution might be to re-cache positions when exiting a container, but I'm not sure about that.

@jelbourn jelbourn merged commit 58b8d30 into angular:master Apr 29, 2020
jelbourn pushed a commit that referenced this pull request Apr 29, 2020
* fix(drag-drop): drop-list wrong enter position
Parent rect should be cached again when the new item has been added.
If item is entering from start (left/top) it should be inserted in the first position.
When looking for item index from pointer position exclude right/bottom pixel: that pixel is external.

* Corrected a bug when entering with no active draggables.

* Corrected enter behavior on reversed container
Added unit tests to cover fixed scenarios

* Fixed view-engine broken test
@albyrock87 albyrock87 deleted the drop-list-enter-position-fixes branch May 12, 2020 11:55
crisbeto added a commit to crisbeto/material2 that referenced this pull request May 14, 2020
…ntermediate child

In angular#19116 some logic was added so that we use `insertBefore` when an item is entering from the top, rather than `appendChild`. The problem is that an error will be thrown if the first item in the drop list isn't a sibling of the first draggable element.

Fixes angular#19359.
jelbourn pushed a commit that referenced this pull request May 21, 2020
…ntermediate child (#19361)

In #19116 some logic was added so that we use `insertBefore` when an item is entering from the top, rather than `appendChild`. The problem is that an error will be thrown if the first item in the drop list isn't a sibling of the first draggable element.

Fixes #19359.
jelbourn pushed a commit that referenced this pull request May 21, 2020
…ntermediate child (#19361)

In #19116 some logic was added so that we use `insertBefore` when an item is entering from the top, rather than `appendChild`. The problem is that an error will be thrown if the first item in the drop list isn't a sibling of the first draggable element.

Fixes #19359.
@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 Jun 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants