Add Block: Navigation
...Which I think we should rename to "Navigation Menu." :)
I have a lot of questions around best practices for something this dynamic:
- Should the menu building happen in the Inspector, or in the preview?
- Like the Custom HTML block, should there be a way to toggle between entering content and previewing it?
- Should the block start with any pages, or should it be totally empty when you make a new block?
- Should we have an option to display pages as a vertical list, or a horizontal bar/list?
Related to #1011.
Also worth noting: once we establish the pattern for "building" a block's content in Gutenberg, we can also then show how that could be applied to something like a contact form block.
@melchoyce just to clarify, are we trying to replicate experience from: Appearance > Widgets or Appearance Menus?
I started to think through how the experience should be with the Widgets but realized I should check first.

To be honest, I don't think we should necessarily replicate either — I think this would be a good chance to re-examine what it looks like to build a menu, independent of menu locations. Maybe in the short-term, any menu built as a block is back-compat as a new menu to nav-menus.php so you can use it in other places, but in the long run, I think abandoning menu locations for blocks is going to make site building much easier to understand.
What do you think about this? Anything we should change/add/remove?

So: list of pages/etc. in the inspector, drag (or tap) from the inspector into the menu block? That's an interesting idea — @jasmussen, what do you think?
Since this is a complex block, it might be good to explore a couple different ideas before settling on a direction.
Since this is a complex block, it might be good to explore a couple different ideas before settling on a direction.
Absolutely! I think this idea is one direction to pursue, but would love to see what others come up with.
✨
Solid discussion, great ideas. I think the inspector feels like the obvious place to configure the contents of this block, yes, but even then it's just nice to see baby steps to fix this.
I think a pretty key aspect to figure out, and perhaps this overlaps with #1516, is how do you save these menus and how can you re-use an existing menu. Does each menu you save become a new block in the inserter? Or is there a single menu block you insert, and you then pick a saved menu from the block itself as the first step? And/or customize it then and there? Probably good to explore a few directions so we can cauterize them until only the best approach remains. (As Mel essentially said already)
how do you save these menus and how can you re-use an existing menu.
I feel the shared blocks idea is how to deal with it, without making an ad-hoc UI specifically for menus.
In the work I've done so far with menus both .org and .com the "reusability" factor didn't show up as a user need, and in fact caused a LOT of trouble due to how complicated it made the UI (associating a menu is a hard concept to grasp).
I'd consider not addressing that part of the UI for the time being, and iterate back once #1516 reaches a solid v1.
I think the initial version of the block should omit the “create a new menu” link. This is only present in the Customizer, and it is not available on the Custom Menu widget that appears on the widgets admin screen.
Aside from the issue of being able to create a new menu in a block which isn't yet published (i.e. what the Customizer implements as a placeholder menu), an additional complication for the menu block is that nav menus aren't yet available for manipulation via the REST API.
@westonruter I think those are issues we're going to want to solve before pushing up this block — definitely before launching it to the next-gen Customizer. I think it's worth doing the hard work now so we can create a block with a more ideal menu creation process.
Okay, this might be terrible, but here's another menu idea:

This one takes some cues from the inserter and the existing Customizer menu patterns. The block shows an abstracted live preview, and all the editing happens in the Inspector. When you add a menu item, a menu item picker styled after the Inserter pops up.
Please note there's a bunch of stuff missing, and this is just to get some more conversation rolling. :)
@melchoyce It seems a bit outside the pattern of how blocks have been implemented to have the block manipulation disconnected from the block preview. Should it not be inline? If the inspector has been deemed the area where “advanced” settings are managed, I don't think we should manage the menu items in the inspector. I think the items should be manipulated inline in the block itself. When the block is not selected, it can appear as you have mocked above. When you have selected the block, then its focused state can then turn each of the menu items into draggable elements. Maybe the UI for searching for items to add could be in the inspector, or maybe that too should be shown as a floating panel above the block.
I'm happy that we're looking at implementing the nav menu item management UI in components!
Yup, could totally be a bad idea. :) Trying to explore as many options as we can, since sometimes great ideas emerge from putting out as many bad ideas as we can.
Here's one that would do all the editing and adding from inside the block:
Unselected, you'd see an abstracted live preview. When you click into the block, you'd get the menu builder. It would use the same page-insert popover as my previous idea. The inspector would only be used for settings.
sometimes great ideas emerge from putting out as many bad ideas as we can.
❤️
This is a 🌟🌟🌟🌟🌟 ticket, and I love the way this is evolving.
Less sketchy:

I like this a lot. I presume that items in the the menu item inspector could be dragged into place, in addition to being added at the end if one is simply clicked?
(Initial comment had typo “Unlike” instead of “I like”!)
With tabs at the bottom:

keyboard users would be forced to tab through (potentially) dozens or hundreds of links before reaching the Pages | Links | Other tabs. Then, once there, they would be forced to navigate backwards through dozens or hundreds of links to go back to the search or to make their choice.
I don't think we should necessarily replicate either — I think this would be a good chance to re-examine what it looks like to build a menu
I'd totally second this 🙂 it would be great to examine in depth what the biggest flaws are in the current menu building experience (both Menus screen and Customizer) and try to simplify as much as possible.
Worth noting plugins can add their own custom post types and custom taxonomies, and then they become available as "groups"; see for example what happens with Jetpack enabled and with some existing Testimonials, Projects, and Project taxonomies:

Should all this go under the "Other" tab?
Great ideas in here so far! I like both 'angles' (choosing the items from the inspector or choosing them inline, inspector style), but I was thinking what would be the most pleasant way to do this on mobile, and then I think my preference goes to the inspector, with the block being the live preview.
Something like this - borrowing mel's sketch template for a sec 🙂 :

If we're opening a menu on mobile, might as well have all the options in the same place I reckon? And then easy tap-to-select for each item. Possibly divided into multiple categories, for those custom menu items @afercia mentioned.
I like the idea of naming and saving the menu in the block, like @jwold's second mockup. We should also at least put a button in there when the menu is empty that says 'start adding items" or something, which opens/focuses the inspector.
And I like the idea of rearranging in the block itself, it feels like more of a 'presentational' edit. I'd much prefer to have true drag-n-drop for that though.
I really really like https://github.com/WordPress/gutenberg/issues/1466#issuecomment-317271653.
To me, it feels like it really captures the spirit of blocks as I have imagined them:
- Unselected serves as preview
- Selected serves as option to customize
- Advanced configuration that is non-critical to the operation, like layout, is in the block inspector
To elaborate a bit on "non-critical stuff in inspector" — examples would be changing defaults like the layout, number of posts in "Recent posts", drop cap for text. Anything that you don't actually have to adjust in order for the block itself to work. The thing is, the sidebar is dismissable.
Some questions to explore together:
- There doesn't seem to be a quick toolbar. I think the quick toolbar will probably be where at least some layout options appear.
- In the sketch the block is not full width, which every block is by default when inserted. It looks like it's left floated.
Maybe this type of block doesn't concern itself with layout at all, and so it comes with no options to configure it — it's just a menu, and it is subject to the layout given by the page building magic that we need to think about. It depends on what purposes this block can serve, outside of its usefulness in a page building context. Would there ever be cases where this block is nice to insert inside a post?