-
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
Revert "Support drag-and-drop for submenus of navigation blocks (#24479)" #30209
Conversation
…)" This reverts commit 748c632.
@@ -50,12 +50,12 @@ export function useBlockClassNames( clientId ) { | |||
spotlightEntityBlocks | |||
); | |||
return classnames( 'block-editor-block-list__block', { | |||
'is-selected': isSelected && ! isDragging, |
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.
This was a strange change. We shouldn't have to remove this class.
Size Change: -475 B (0%) Total Size: 1.41 MB
ℹ️ View Unchanged
|
Thanks for the initial effort. It's important to get drag and drop right across the editor, and the more holistically we can do that, the better. That principle remains even if we need to revert this. I'll give this more testing tomorrow, including on the navigation screen, but wanted to share a 👍. |
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.
Thanks @ellatrix for debugging with me and spinning up the revert 💖 This tests well for me. I verified that we can still add items to the navigation block, add submenus, add items to the submenus, type to edit links and drag items within the navigation block without the block throwing an error or a WSOD for the editor.
For folks 👀 the PR, one thing to keep in mind for a potential second attempt is to aim for solving the general case, instead of adding custom code in the block:
One of the most important aspects of the navigation block is that it helps define child block APIs we can use in other blocks. Any time it deviates or does something custom we lose that advantage and create an extra point of maintenance, code debt, and fragility -- @mtias
Expected updated change in behavior:
We can't drag top level items into submenu, but we can still drag submenu items into the top level.
updatedbehavior.mp4
Horizontal Drag
horizontalmenu.mp4
Vertical Drag
verticaldrag.mp4
verticalsubmenu.mp4
I'm fine with fixing it with #30219 and keeping the custom behaviour. Hopefully we can make it part of the block editor some time. |
This reverts commit 748c632.
Description
Fixes #30177.
Unfortunately we have to revert #24479.
After a refactoring (#29186) the custom drag behaviour of the navigation link block is throwing an infinite loop error.
If we want better drag and drop behaviour in nested contexts, we could implement this in the block editor rather than the block.
How has this been tested?
Dragging a navigation link block within the navigation block should work again.
Screenshots
Types of changes
Checklist: