Skip to content
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

DropZone component no longer provides x and y position #23149

Closed
talldan opened this issue Jun 15, 2020 · 5 comments · Fixed by #23577
Closed

DropZone component no longer provides x and y position #23149

talldan opened this issue Jun 15, 2020 · 5 comments · Fixed by #23577
Assignees
Labels
[Feature] Drag and Drop Drag and drop functionality when working with blocks [Status] In Progress Tracking issues with work in progress [Type] Developer Documentation Documentation for developers

Comments

@talldan
Copy link
Contributor

talldan commented Jun 15, 2020

Describe the bug
(Originally reported in the Making WordPress slack: https://wordpress.slack.com/archives/C02QB2JS7/p1591999141128800)

The DropZone component no longer provides x and y position to its callback.

It looks like when DropZone was rewritten to use a hook an optional withPosition prop that defaults to a falsey was added, possibly as an optimization:

The DropZone component doesn't have a way to set this value, so since this change x and y are not provided:

function DropZoneComponent( {
className,
label,
onFilesDrop,
onHTMLDrop,
onDrop,
} ) {

To reproduce
Steps to reproduce the behavior:
Reproduction is a little tricky, as it requires implementation of a drop zone.

Expected behavior
DropZone continues to provide x and y position data by default.

@talldan talldan added [Type] Bug An existing feature does not function as intended Backwards Compatibility Issues or PRs that impact backwards compatability [Feature] Drag and Drop Drag and drop functionality when working with blocks labels Jun 15, 2020
@ellatrix
Copy link
Member

Do you mean this? #19514 (comment)

Either way, I think this was part of the 5.4 release? #20185 (comment)

@talldan
Copy link
Contributor Author

talldan commented Jun 30, 2020

@ellatrix I think it was that PR. As you say, looks like it was already shipped in 5.4, so perhaps this isn't a 5.5 must have.

@talldan
Copy link
Contributor Author

talldan commented Jun 30, 2020

This looks like the line:
https://github.com/WordPress/gutenberg/pull/19514/files#diff-af960f1a0848b34c0c03399a679e8c4dR143

I think it should be a pretty easy issue to solve, we'd need to expose the withPosition prop for the DropZone component. Possibly default it to true for backwards compatibility.

I can put together a PR.

@talldan
Copy link
Contributor Author

talldan commented Jun 30, 2020

Oh wait (sorry for multiple messages), I see what you mean now, that this is a separate position object that only provided the edge being dropped to and was only used in the drop events.

So, looks like it needed to be removed from the docs? I'll make the focus of my PR in that case.

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jun 30, 2020
@talldan talldan added [Type] Developer Documentation Documentation for developers and removed Backwards Compatibility Issues or PRs that impact backwards compatability [Type] Bug An existing feature does not function as intended labels Jun 30, 2020
@talldan
Copy link
Contributor Author

talldan commented Jun 30, 2020

#23577 updates the DropZone readme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Drag and Drop Drag and drop functionality when working with blocks [Status] In Progress Tracking issues with work in progress [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants