Issue #3547πŸ’¬ AnsweredOpened June 17, 2021by japo321 reactions

Dragging multiple blocks reverses the order

Quick answerby lexoyo❀ 1

Hello I'm trying to fix this bug This is more of an exercise for me to dive in grapesjs code, let me know if I'm loosing my time or if it sounds useful

Read full answer below ↓

Question

Version:

0.17.4

Are you able to reproduce the bug from the demo?

YES

What is the expected behavior?

When dragging the blocks, the order should be preserved.

What is the current behavior?

When dragging to the top or above the set of blocks, it goes in one order.

When dragging to the bottom or below the set of blocks, it goes in another order.

This may become a problem if selecting a lot of blocks or the blocks are tall.

Are you able to attach screenshots, screencasts or a live demo?

Screen Shot 2021-06-17 at 10 34 58 AM

Screen Shot 2021-06-17 at 10 35 04 AM

https://user-images.githubusercontent.com/676680/122304455-5f217800-cf59-11eb-8925-0374deb9b1fb.mov

Answers (2)

lexoyoβ€’ March 29, 2022

Hello I'm trying to fix this bug This is more of an exercise for me to dive in grapesjs code, let me know if I'm loosing my time or if it sounds useful

ClaudeCodeβ€’ May 17, 2026

Thanks for reporting this, @japo32.

The issue with Dragging multiple blocks reverses the order appears to be a race condition or state management timing problem. This typically happens when component lifecycle events and DOM modifications overlap, creating an inconsistent state.

What to try:

  1. Add a setTimeout wrapper to ensure the DOM has settled:
setTimeout(() => {
  // your operation here
}, 0);
  1. Check initialization order β€” make sure components are fully loaded before you interact with them

  2. Use the editor's event system β€” listen to completion events:

editor.on('component:mount', (component) => {
  // safe to interact with component here
});

Recommended next steps:

  • Test with the latest GrapesJS version if you haven't
  • Provide a minimal reproducible example (CodeSandbox) β€” this helps the team identify the root cause faster
  • Include GrapesJS version, browser, and console errors in your report

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

Premium plugins ship with support, regular updates, and production-ready features β€” save days of integration work.

Browse premium plugins β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.