-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Enable easier drag and drop for navigation building #45906
Conversation
…drag and drop in list view
Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
Size Change: +82 B (0%) Total Size: 1.3 MB
ℹ️ View Unchanged
|
This is working nicely! I tried it with social links and a site logo blocks too and they all move correctly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feature works really well. A couple of minor comments on the code, but other than that it looks good.
@@ -544,7 +547,7 @@ export default function NavigationLinkEdit( { | |||
if ( hasChildren ) { | |||
transformToSubmenu(); | |||
} | |||
}, [] ); | |||
} ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the dependency list was removed?
This code wasn't great in trunk
, so there's an opportunity to improve it.
I think it'd be better to split it into two effects. A first for the setIsLinkOpen
part, which would have url
as a dep, the other for the transformToSubmenu
part which would have hasChildren
as a dep.
if ( ! hasChildren ) { | ||
transformToLink(); | ||
} | ||
} ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing dependencies here too.
I found a bug, trying to remove one of the menu items via the 3 dots menu, this is not happening on trunk:
![Screen Capture on 2022-11-21 at 13-08-23](https://user-images.githubusercontent.com/3593343/203050617-088ae7b3-6aa6-4e98-9a3f-6b33e1ea6859.gif)
|
Also, if there nothing below it a submenu, I can't get the last item to drag and drop outside the submenu:
https://user-images.githubusercontent.com/275961/203051979-578f2e82-ec54-42f5-aa98-5f14c9d1f61f.mp4
|
I also find the drop position to create a submenu very unintuitive, but that might be outside the scope of this PR
https://user-images.githubusercontent.com/275961/203053002-54fb9806-4b20-41b6-9f74-988ccfd206f5.mp4
|
@scruffian the bits about dragging the last item and about the drop position are pertaining to the list view's drag and drop nesting in general. |
Co-authored-by: Daniel Richards <[email protected]> Co-authored-by: Maggie <[email protected]> Co-authored-by: Ben Dwyer <[email protected]>
What?
This PR makes the drag and drop of navigation inner blocks more seamless.
Why?
With the addition of a list view in the navigation block's inspector drag and drop should work seamlessly for its allowed inner blocks. This isn't the case now:
This is unexpected and makes the UX cumbersome. We have some items that were stop gap solutions such as:
These are also in need of simplification.
How?
To do:
Testing Instructions
Screenshots or screencast
drag-drop-menu-building.mp4