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

Drag and drop does not work correctly with horizontal block lists #22662

Closed
talldan opened this issue May 27, 2020 · 0 comments · Fixed by #23020
Closed

Drag and drop does not work correctly with horizontal block lists #22662

talldan opened this issue May 27, 2020 · 0 comments · Fixed by #23020
Assignees
Labels
[Feature] Drag and Drop Drag and drop functionality when working with blocks [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@talldan
Copy link
Contributor

talldan commented May 27, 2020

Describe the bug
This is something that I only discovered by looking at the code, but Drag and Drop only works correctly with vertical block lists.

The useBlockDropZone hook only uses the y position for determining the drop position:
https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/use-block-drop-zone/index.js#L184-L206.

Often the block ends up in the wrong place and the drop zone is highlighted incorrectly.

Seems like this was probably an accidental oversight when introducing horizontal block lists.

To reproduce
Steps to reproduce the behavior:

  1. Add a buttons block and add multiple buttons
  2. Try to reorder them using drag and drop
  3. Observe the behavior is unpredictable and

Expected behavior
Drag and dropping works consistently in horizontal block lists:

  • Blocks drop in the correct location
  • Drop zones are indicated correctly using vertial lines/border.
@talldan talldan added [Type] Bug An existing feature does not function as intended [Status] In Progress Tracking issues with work in progress [Feature] Drag and Drop Drag and drop functionality when working with blocks labels May 27, 2020
@talldan talldan self-assigned this May 27, 2020
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] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant