Skip to content

fix drag drop cause removing wrong element#6692

Open
them7d wants to merge 1 commit intoGrapesJS:devfrom
them7d:dev
Open

fix drag drop cause removing wrong element#6692
them7d wants to merge 1 commit intoGrapesJS:devfrom
them7d:dev

Conversation

@them7d
Copy link

@them7d them7d commented Jan 21, 2026

fix #6666
This PR addresses issues with component sorting and movement by removing visibility filters in BaseComponentNode.
Previously, hidden components were excluded from the children list, which led to incorrect index calculations (cause removing element when invisible element in the same collection) when attempting to move or remove items (resorting the tree).

Additionally, CanvasNewComponentNode has been updated to correctly handle index offsets when checking or moving multiple components (e.g., arrays of content), ensuring that each item is processed at the correct position.

Changes:

  • BaseComponentNode.ts: Removed getDisplayedChildren, isChildDisplayed, and the isDisplayed helper. getChildren now returns all components from the model, regardless of visibility.

  • CanvasNewComponentNode.ts: Updated canMove logic to account for the index offset (index + i) when validating moves for array content.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Layer panel: drag and drop makes items disappear (firefox and chrome)

1 participant