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

Navigation block: prevent drag & drop out of the editable list view sidebar #46994

Open
annezazu opened this issue Jan 9, 2023 · 12 comments
Open
Assignees
Labels
[Block] Navigation Affects the Navigation Block [Feature] Drag and Drop Drag and drop functionality when working with blocks [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@annezazu
Copy link
Contributor

annezazu commented Jan 9, 2023

Description

Using the new navigation block experience with Gutenberg 14.9, I noticed I could drag and drop the page list block out of the sidebar and onto the page, making for a very confusing experience.

Step-by-step reproduction instructions

  1. Use GB 14.9 and open the Site Editor
  2. Ensure a page list block is in place in the navigation block
  3. Notice you can drag and drop the page list block out of the sidebar entirely seemingly causing the menu to disappear.

Screenshots, screen recording, code snippet

drag.drop.page.list.block.mov

Environment info

  • WP 6.1.1
  • GB 14.9
  • TT3

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@getdave
Copy link
Contributor

getdave commented Jan 30, 2023

This is a great bug find. I'll take a look into it.

@getdave getdave added the [Status] In Progress Tracking issues with work in progress label Jan 30, 2023
@getdave getdave self-assigned this Jan 30, 2023
@getdave
Copy link
Contributor

getdave commented Jan 30, 2023

Was able to replicate but had to have other blocks in the canvas which I could drag the Page List into.

@draganescu
Copy link
Contributor

This problem exists in the list view as well.

@getdave
Copy link
Contributor

getdave commented Jan 30, 2023

My plan here is to:

  • add metadata to each dropzone to indicate it's context (i.e. canvas, list view...etc)
  • add data to each drag operation indicating the original of the drag
  • in the dragend event check whether the origin data in the drag event matches that of the dropzone and handle accordingly
    • if different - cancel the drop operation
    • if matching - allow the drop
  • also it would be good to check if there's a way to do the comparison during the drag operation so that we can indicate which dropzones are appropriate for the given drag

@talldan
Copy link
Contributor

talldan commented Jan 31, 2023

Hmm, this is actually a feature, not a bug.

I guess it might not make much sense for the off canvas editor, but for the persistent list view it works that way on purpose. You can drag from the canvas into List View or the other way around.

@getdave
Copy link
Contributor

getdave commented Jan 31, 2023

Ah I see. Well thanks for clarifying. For the Nav block offcanvas this does not make sense to me so I still think we should "fix" it. What do you think @draganescu?

@draganescu
Copy link
Contributor

You can drag from the canvas into List View or the other way around.

Does anyone actually do that and not think they broke the thing?

@talldan
Copy link
Contributor

talldan commented Jan 31, 2023

I don't really know why you would do it if it wasn't on purpose 🤔

@annezazu
Copy link
Contributor Author

annezazu commented Feb 1, 2023

TBH I did it by accident and very easily when trying to rearrange navigation items. I think that's going to be a pretty common use case and it just takes a slight slip to drop it in the canvas.

@andrewserong
Copy link
Contributor

I guess it might not make much sense for the off canvas editor, but for the persistent list view it works that way on purpose. You can drag from the canvas into List View or the other way around.

Thanks, I was just going to mention that this is a really useful feature for the main list view, so that folks can drag an item from the list view onto the editor canvas and see visually where the item is going to land.

That said, if it's important to fix for the cases of the navigation block or other potential uses of the list view, I quite like @getdave's idea of adding in some kind of context for the drag and drop (#46994 (comment)) — it sounds like we'd want to still allow the drag and drop between the main list view and editor canvas, but not between the Navigation block's sidebar list view and the editor canvas.

@scruffian
Copy link
Contributor

Thinking about this more, is this actually a problem? I think it behaves as I would expect as a user.

@annezazu
Copy link
Contributor Author

annezazu commented May 5, 2023

I'll note that I did it completely by mistake when trying to use drag and drop. I found it pretty frustrating as it created more work for me to undo and it's not a common action I think anyone would want to take from there.

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] Drag and Drop Drag and drop functionality when working with blocks [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants