-
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
Add submenu menu item to list view #45794
Conversation
Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
Size Change: +91 B (0%) Total Size: 1.3 MB
ℹ️ View Unchanged
|
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.
Cool! It's a start 🚀 Tested this and it's tricky so far:
- adding a sumbenu on a link converts the link to a submenu and adds a link under it. Is this what I wanted? Did I want to add a "submenu" after this item?
- we need to fix how this works if the item is already a submenu and has contents (they need to be preserved ofc).
- this PR would also be a great exploration of how the LinkUI appears on top of the list view like in the designs.
I also think the wording could be a bit fiddled with ... Add submenu item or Add nested link or something.
packages/block-editor/src/components/off-canvas-editor/block.js
Outdated
Show resolved
Hide resolved
We should exclude the "show / hide more settings" given we are in that panel already. Also we should move this item towards the top. |
@ajlende FYI I'm going to remove the "Select parent" as well because you already have the "parent" selected (strangely). |
@ajlende Do you have any ideas on how we can selectively enable/disable items in this menu without disrupting the existing List View? Perhaps we just need props which default to Open to better suggestions though... |
The list view and the nav list are probably going to continue to diverge, so I think adding a boolean for every option will be bad for maintainability in the future. I think it's really common to add options like this in Gutenberg because it makes for smaller PRs that are more likely to get merged, but they get in the way in the long-term. I think a better approach would be to break the component down into parts that we can reuse, and for the nav list, we just don't use the parts that we don't need. Unfortunately, doing it this way seems substantially more difficult in the short-term as it already feels a bit like a tangled mess. |
4e32ca3
to
5d28673
Compare
I think these should be done in separate follow-up PRs since they involve updating the |
I don't think they should diverge that much. The show/settings is a context one (you are already in settings). Outside of that, we should aim to have the same set. The "add submenu" one would be useful in the main list view as well. One thing I think we might need to introduce is block specific context so that block specific tools are grouped and separated from general block tools. |
I think that could be pretty useful. |
5d28673
to
2e49a98
Compare
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 for working on this. LGTM.
I suggest we merge this and create issues for the follow up items.
What?
Closes #45441
Adds a menu item to the list view items to add a submenu
Why?
How?
Testing Instructions
Off canvas navigation editor
experiment is enabledScreenshots or screencast