Skip to content

fix(drag-drop): stop dragging sequence on touchcancel #12935

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

Closed
wants to merge 1 commit into from

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Sep 1, 2018

Adds handling for the touchcancel event to the the DragDropRegistry.

Also makes the unit tests slightly more strict.

@crisbeto crisbeto added the target: major This PR is targeted for the next major release label Sep 1, 2018
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Sep 1, 2018
// Treat `touchcancel` events the same as `touchend`. `touchcancel` will fire for cases
// like an OS-level event interrupting the touch sequence or the user putting too many
// finger on the screen at the same time.
this._globalListeners.set('touchcancel', upConfig);
Copy link
Member

@jelbourn jelbourn Sep 4, 2018

Choose a reason for hiding this comment

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

Would this mean that a touchcancel would effectively count as a "drop" of you had your finger over a cdk-drop?

Copy link
Member Author

Choose a reason for hiding this comment

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

It does, but I think that this is what we want since it's the event that fires instead of touchend if something like an OS popup interrupts the dragging.

Copy link
Member

Choose a reason for hiding this comment

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

Would it be difficult to abort the drop for this case? I would think that's the safest course of action, since we'll never know whether the drop will be committing some meaningful action (like sending a missile alert for Hawaii...)

Copy link
Member Author

Choose a reason for hiding this comment

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

Currently we have most the necessary info, but we don't have an API to abort a drag. I could set something up, but it means that there would be another event that the consumer needs to be aware about and that even can only realistically fire on a touch device.

Copy link
Member

Choose a reason for hiding this comment

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

I think it would still be better to abort though; even though it's an edge case, I except any "cancelled" action to have no effect

@crisbeto crisbeto added target: patch This PR is targeted for the next patch release and removed target: major This PR is targeted for the next major release labels Oct 18, 2018
@crisbeto crisbeto force-pushed the drag-drop-touchcancel branch 2 times, most recently from 0244663 to 44bf258 Compare November 8, 2018 08:22
@ngbot
Copy link

ngbot bot commented Nov 8, 2018

Hi @crisbeto! This PR has merge conflicts due to recent upstream merges.
Please help to unblock it by resolving these conflicts. Thanks!

@crisbeto crisbeto force-pushed the drag-drop-touchcancel branch from 44bf258 to 1735502 Compare November 8, 2018 22:43
@jelbourn
Copy link
Member

jelbourn commented Dec 4, 2018

Where did we leave off on this PR?

@crisbeto
Copy link
Member Author

crisbeto commented Dec 5, 2018

If I remember correctly, we talked about having a method to abort a dragging sequence, but the PR got buried under some other work and I never got around to adding one.

@crisbeto crisbeto force-pushed the drag-drop-touchcancel branch from 1735502 to 0e50290 Compare December 14, 2018 07:11
@mmalerba mmalerba added aaa and removed aaa labels Apr 25, 2019
Adds handling for the `touchcancel` event to the the `DragDropRegistry`.
@crisbeto crisbeto force-pushed the drag-drop-touchcancel branch from 0e50290 to e6db9d3 Compare July 10, 2019 21:02
@samyue
Copy link

samyue commented Jul 17, 2020

Any update on this? I would like to be able to stop a DnD when user presses ESC key.

@RadhikaGunisetty
Copy link

@crisbeto Are there any updates for this PR?

@crisbeto
Copy link
Member Author

There aren't any updates, I haven't had the time to revisit it.

@andrewseguin andrewseguin removed the cla: yes PR author has agreed to Google's Contributor License Agreement label Dec 29, 2021
@josephperrott josephperrott added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed needs rebase labels Nov 16, 2022
@crisbeto
Copy link
Member Author

Superseded by #30184.

@crisbeto crisbeto closed this Dec 14, 2024
@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 Jan 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants