-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Conversation
// 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); |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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...)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
0244663
to
44bf258
Compare
Hi @crisbeto! This PR has merge conflicts due to recent upstream merges. |
44bf258
to
1735502
Compare
Where did we leave off on this PR? |
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. |
1735502
to
0e50290
Compare
Adds handling for the `touchcancel` event to the the `DragDropRegistry`.
0e50290
to
e6db9d3
Compare
Any update on this? I would like to be able to stop a DnD when user presses ESC key. |
@crisbeto Are there any updates for this PR? |
There aren't any updates, I haven't had the time to revisit it. |
Superseded by #30184. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Adds handling for the
touchcancel
event to the theDragDropRegistry
.Also makes the unit tests slightly more strict.