Grid: Swap the position of grid items when they are re-arranged in the List View? #63974
Labels
[Feature] Layout
Layout block support, its UI controls, and style output.
[Type] Discussion
For issues that are high-level and not yet ready to implement.
When using a Grid block set to Manual mode, you can drag and drop grid items to arbitrary cells which updates the
columnStart
androwStart
of that block. When this happens we also change the block's position in the block list (grid.innerBlocks
) so that the DOM order of the blocks roughly matches the visual order.We don't currently do this the other way around though. If you change the order of the Grid block's children using List View, only the markup order will change (useful for stacking!) and the blocks won't visually move around. This could be confusing.
I have three ideas:
1) We could do nothing.
List View would be for solely changing the DOM order of the grid's children, which is how you'd control which grid items are stacked on top of other grid items.
2) We could disable List View.
If we did not allow drag-and-drop-to-reorder in List View then this confusing interaction would go away. We'd need a new way of controlling which grid items are stacked on top of other grid items, though. Potentially we could add "Bring to front" and "Send to back" controls which are popular in lots of other editors. Related to #63971.
3) We could write logic that swaps the visual position of blocks when their order changes.
Say you had a block tree like this:
If the user re-orders D to be in between A and B then we could write logic that swaps the
columnStart
androwStart
attributes like so:The text was updated successfully, but these errors were encountered: