Skip to content

fix(drag-drop): error if next sibling is removed after drag sequence has started #18230

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 1 commit into from
Jan 27, 2020

Conversation

crisbeto
Copy link
Member

When a drag sequence is started, we save a reference to the next sibling of the drag element so that we can use it at the end of the sequence to restore the element's original DOM position. This breaks down and throws an error if the next sibling gets removed while the user is dragging. These changes make the approach a bit more robust by inserting a comment node instead.

Fixes #18205.

@crisbeto crisbeto added 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 Jan 20, 2020
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jan 20, 2020
@crisbeto crisbeto force-pushed the 18205/drag-drop-sibling-remove branch from f91b314 to 0aa1795 Compare January 20, 2020 19:54
…has started

When a drag sequence is started, we save a reference to the next sibling of the drag element so that we can use it at the end of the sequence to restore the element's original DOM position. This breaks down and throws an error if the next sibling gets removed while the user is dragging. These changes make the approach a bit more robust by inserting a comment node instead.

Fixes angular#18205.
@crisbeto crisbeto force-pushed the 18205/drag-drop-sibling-remove branch from 0aa1795 to 037bb90 Compare January 24, 2020 21:26
*/
private _nextSibling: Node | null;
private _anchor: Comment;
Copy link
Member

Choose a reason for hiding this comment

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

Could we do _placeholder instead of _anchor to avoid overload with <a>?

Copy link
Member Author

Choose a reason for hiding this comment

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

We can't, because there's something different that we're calling a _placeholder already (the element shown in the place of the one you're dragging).

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

Ah, right. Maybe something like originalLocationMarker.

Either way, LGTM, don't feel super strongly

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Jan 26, 2020
@jelbourn jelbourn merged commit d05c695 into angular:master Jan 27, 2020
jelbourn pushed a commit that referenced this pull request Jan 27, 2020
…has started (#18230)

When a drag sequence is started, we save a reference to the next sibling of the drag element so that we can use it at the end of the sequence to restore the element's original DOM position. This breaks down and throws an error if the next sibling gets removed while the user is dragging. These changes make the approach a bit more robust by inserting a comment node instead.

Fixes #18205.

(cherry picked from commit d05c695)
yifange pushed a commit to yifange/components that referenced this pull request Jan 30, 2020
…has started (angular#18230)

When a drag sequence is started, we save a reference to the next sibling of the drag element so that we can use it at the end of the sequence to restore the element's original DOM position. This breaks down and throws an error if the next sibling gets removed while the user is dragging. These changes make the approach a bit more robust by inserting a comment node instead.

Fixes angular#18205.
@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 Feb 27, 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.

CDK Drag and Drop: Unhandled Promise rejection in _cleanupDragArtifacts when ngbTooltip is used on cdkDrag element.
3 participants