Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List View: Allow drag and drop to reorder items #29727

Closed
Tracked by #29733
jasmussen opened this issue Mar 10, 2021 · 6 comments · Fixed by #33320
Closed
Tracked by #29733

List View: Allow drag and drop to reorder items #29727

jasmussen opened this issue Mar 10, 2021 · 6 comments · Fixed by #33320
Assignees
Labels
[Block] Navigation Affects the Navigation Block [Feature] List View Menu item in the top toolbar to select blocks from a list of links. [Status] In Progress Tracking issues with work in progress

Comments

@jasmussen
Copy link
Contributor

What problem does this address?

We have numerous tools to reorder blocks. The List View provides a glancable tool of your site structure, and is used in a few places, it's in the post editor, it's in the post editor, it works as a persistent sidebar in the site editor, and it exists as a tool for the navigation block.

We could offer an additional drag and drop affordance in this tool, which might be useful for very long posts, or for the navigation which might feature complex nesting in menus.

What is your proposed solution?

Note: This change should apply to anywhere we use the List View component. Here shown for the Navigation block:

list view

Make the entire list view item draggable:

list view hover

You'd still be able to focus the item itself, or the ellipsis, individually:

focus

The ellipsis menu contains a "Move to..." item that duplicates the move action.

@jasmussen jasmussen added [Feature] List View Menu item in the top toolbar to select blocks from a list of links. [Block] Navigation Affects the Navigation Block labels Mar 10, 2021
@mtias
Copy link
Member

mtias commented Mar 10, 2021

For reference, we added drag support in #23952. Let's treat this as a great refinement on the presentation and to ensure we apply it throughout the different "block navigator" place now that the List View is a full panel.

@priethor
Copy link
Contributor

Closely related to #25067.

@talldan
Copy link
Contributor

talldan commented Mar 11, 2021

Yep, as mentioned drag and drop should hopefully still be working, it needs to be enabled.

One thing that was hard to achieve in #23952 was the drop indicator styling. I think that may have regressed as well with styling changes to List View. It should show a blue line that's as wide as the item when dropping as a sibling, and a slightly indented line when dropping as a child (handled by dragging on the right side of the item).

And I never quite came up with a way to un-nest items through drag and drop. That could still be worked on.

Finally, I think it may also need some optimisation. 😄

@jasmussen
Copy link
Contributor Author

What will it take to enable drag and drop for all instances of the list-view?

@priethor
Copy link
Contributor

priethor commented Mar 11, 2021

Right now the drag and drop is behind a __experimentalFeatures flag in the BlockNavigation component. However, other instances might add their own experimental flag to control it, as the Persistent List View does in #29729

@jameskoster
Copy link
Contributor

I've been exploring this a bit in figma. Here are the various flows I worked on so far:

  1. Arranging blocks at the same level
  2. Dragging a block down a level in the tree (IE from the root level in to a group), accounting for when the target container is either open or closed
  3. Dragging a block up a level, IE from a group to the root level of the doc.
  4. Dragging a block to an incompatible area of the document, IE dragging a Column block to the root level

The second one feels most complex, so I put a prototype together to demonstrate how that could work:

drag.and.drop.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block [Feature] List View Menu item in the top toolbar to select blocks from a list of links. [Status] In Progress Tracking issues with work in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants