Skip to content

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

Closed

Description

@fullofcaffeine

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

Activity

  1. added
    [Block] Classic
    [Feature] Drag and Drop
    [Type] Bug
    on Jul 24, 2020
  2. geheren commented on Jan 3, 2021

    @geheren
  3. mikeh000 commented on Jan 24, 2021

    @mikeh000

    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.
  4. BenBroide commented on Feb 5, 2021

    @BenBroide

    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

  5. carolinan commented on Feb 6, 2021

    @carolinan
    Contributor

    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

  6. BenBroide commented on Feb 6, 2021

    @BenBroide

    @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

    event.dataTransfer.setData( 'text', JSON.stringify( transferData ) );

  7. BenBroide commented on Feb 6, 2021

    @BenBroide

    Added gif how to reproduce bug 100%
    bug gif grag

  8. BenBroide commented on Feb 6, 2021

    @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
  9. mikeh000 commented on Feb 6, 2021

    @mikeh000

    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.

  10. mikeh000 commented on Mar 17, 2021

    @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).

  11. Mamaduka commented on May 9, 2025

    @Mamaduka
    Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] Classic[Feature] Drag and Drop[Type] Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions