gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

[drag-and-drop] JSON content added to the classic block when dropping another block in / around it

Open fullofcaffeine opened this issue 6 years ago • 10 comments

Describe the bug

Dropping a block onto the Classic block results in JSON code being added to that block’s content as well as the dropped block moving either above or below the classic block.

To reproduce Steps to reproduce the behavior:

  1. Create a most with multiple blocks including a Classic block
  2. While dragging a non-Classic block, drop it on top of the Classic block

Expected The block would be dropped where the indicator line displayed and not add anything into the content of the Classic block.

Actual JSON code was injected into the content of the Classic block in addition to the block actually being moved to the location the drop indicator line showed.

Screenshots

Screencast Click the image to open the video

Editor version (please complete the following information):

  • WordPress version: 5.4.2
  • Does the website has Gutenberg plugin installed, or is it using the block editor that comes by default? gutenberg plugin
  • If the Gutenberg plugin is installed, which version is it? 8.5.1

Desktop (please complete the following information):

  • OS: Linux Mint 18.4
  • Browser: Firefox Quantum
  • Version: 79.0b9

fullofcaffeine avatar Jul 23 '20 21:07 fullofcaffeine

Flagging this from Trac: https://core.trac.wordpress.org/ticket/52168

User shared this screen recording of the same issue.

geheren avatar Jan 03 '21 05:01 geheren

It is very easy to recreate. Here is the screencast: (https://www.screencast.com/t/qcezq4HSE)

  1. Add 2 CLASSIC BLOCKS and an image block, all stacked.
  2. Start moving around one of the classic blocks to different locations, like in screen cast. Eventually it will fill with JSON code.

mikeh000 avatar Jan 24 '21 18:01 mikeh000

It seems like the content of the transfer_block variable is been added to the block content Screen Shot 2021-02-05 at 12 05 17 PM Screen Shot 2021-02-05 at 12 04 00 PM

BenBroide avatar Feb 05 '21 20:02 BenBroide

We were able to reproduce this at the contributor day on February fifth, while user testing drag and drop from the inserter

WordPress 5.7 beta 1 Browser: Google Chrome - Version 88.0.4324.96, Operating system: macOS Catalina - Version 10.15.7, Twenty Twenty-One

The tester shared this screenshot:

JSON inside classic block

carolinan avatar Feb 06 '21 02:02 carolinan

@carolinan This is the object of transferData that is converted into a string and added to the block content after being dragged as you can see in the screenshot I added above. The questions are: Where is logic that converts the transferData object back to a block after dragging? I can't find that part and also can't seem to output changes I do in the drgabble component like console log https://github.com/WordPress/gutenberg/blob/66d46b3c54379732926ba6d3264b5e5d1cbc93fb/packages/components/src/draggable/index.js#L52

BenBroide avatar Feb 06 '21 02:02 BenBroide

Added gif how to reproduce bug 100% bug gif grag

BenBroide avatar Feb 06 '21 03:02 BenBroide

Seems like the gif got cut, however you can see the screen recording here https://recordit.co/d60rsAh3NC steps to reproduce 100% of the times:

  1. add classic block
  2. add regular block below
  3. add classic below
  4. move the regular block above the top classic block

BenBroide avatar Feb 06 '21 03:02 BenBroide

You don't even need to add a regular block. Here is how to reproduce 100% of the time:

  1. Add 2 classic blocks, one on top of the other.
  2. DRAG the bottom classic block above the top classic block

It doesn't seem to happen when you drag the top classic block below the bottom classic block.

mikeh000 avatar Feb 06 '21 17:02 mikeh000

Can anyone please look at this? We have provided screencasts and step by step to reproduce. It's been doing this for at least 10 months or so (even though the bug submission was this summer).

mikeh000 avatar Mar 17 '21 17:03 mikeh000

I'm going to close the issue. I can no longer reproduce the bug.

Mamaduka avatar May 09 '25 10:05 Mamaduka