-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Remove "change" from drag-n-drop events #290
Remove "change" from drag-n-drop events #290
Conversation
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.
Thanks for the contribution! I think a small change is needed here, happy to release it as soon as it's ready
src/constants.js
Outdated
/** | ||
* @see https://developer.mozilla.org/en-US/docs/Web/API/DragEvent | ||
*/ | ||
[SUBJECT_TYPE.DRAG_N_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.
I'm fine with this change. The only think that IMO important is order – it is weird to have dragend
triggered before dragstart
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.
@abramenal Thanks for the quick review! I pushed 8adf3d7 to restore the order in main
with dragover
added before drop
, and dragexit
between dragleave
and dragend
. Happy to make another commit if you have a specific preference of events and order not captured.
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.
Cool stuff, now order is good!
I was checking dragover
event specs on MDN and have an impression that it is triggered on the element that is dragged into dropzone (or anywhere else), but not the dropzone itself.
https://jsfiddle.net/radonirinamaminiaina/zfnj5rv4/
Added console log there, trying to drop labeled div into any other down below:
Can you please double check that?
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.
That sounds (and looks) correct. Should we remove dragexit
as well? That was another event I added, and it does not seem strictly applicable to the usage in this PR, so if we're removing dragover
I think it makes sense to remove dragexit
as well 🙂
EDIT: I've gone ahead and just made the diff removing 'change'
in 055e837, I will update the PR description now.
@all-contributors add @michaeljaltamirano for code |
I've put up a pull request to add @michaeljaltamirano! 🎉 |
Great job @michaeljaltamirano! Let me release this now |
Released in |
Awesome work gang, thanks! |
Checklist:
Summary of changes
A repository I work on is seeing files uploaded twice as mentioned in #276.
I dug into the local
/dist
of this library and noticed that removing'change'
from theSUBJECT_TYPE.DRAG_N_DROP
values resolved my issue locally. It looks like'change'
is not included in the MDN docs for DragEvent.It looks like the tests set up in this library are still passing, so I'm curious to see if this fixes people's issues without causing any regressions 🙂
Linked issues
Closes #276