-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: Menu item enhancements #17539
Comments
The menu item icon in the above design isn't a dashicon is it? Are we moving away from those, and if so, where can I find a suitable SVG asset to replace it with? |
cc. @jasmussen @mapk |
It's this one: https://material.io/resources/icons/?search=naviga&icon=navigation&style=outline You can inline it. Here's an optimized SVG:
|
Thanks @jasmussen! |
About the interaction of linking the menu itemsPart 1: change the inserter or add a block directlyThe point here is that we don't want the inserter to behave differently depending on the block invoking it. If we start modifying the inserter in one block, then we'll have to add a hook by which the contents of the inserter can be changed. If there is such a hook anyone could make the inserter be anything so we loose cohesion in one of the most foundational aspects of working with Gutenberg. The inserter should always show a list of blocks. However, the new exploration in the nav block work is that for a list containing just one item, we shouldn't show a list, but insert the item directly. It makes for an improvement, shortening the number of steps by removing a really useless one. So we should not block this upgrade to the way the inserter behaves simply because we're uncertain about the default state of the menu item. Instead imagine a columns block that for every column the only allowed block is an image. There would be no problem there that when we click on the appender we get an image directly, and there is no problem because the default state of the image block is very explanatory and doesn't look empty. Part 2: link or label firstI think that the reason for the whole debate is that we think of a menu as a collection of menu items, when in fact the menu is a collection of links. In creating a link the steps are:
That is because the most basic thing one needs for a link is the label, the clickable thing. Only after that the destination is important, hence the link is added later. In case of the menu we can argue the same: first we need a label and after we have a label we decide what the link is. Yet, because we are in a menu item which is all but a collection of links, we know that everything is linkable in the context of an item, therefore we remove one step from the general way of creating links, the selection:
This approach nevertheless has the disatvantage that the default state of the menu item looks empty. When people write hyper text they are composing so the links are part of the form of the composition. When creating a collection people are not composing anymore, we are more strongly oriented on the functional liason that holds the collection as a concept. In the case of menu, the functional liason is the link. That means the basic first step we all think of is "I will add a new link to the menu". Because we start with the functional idea of link, we shluld expect that adding the link is the fist thing the UI presents to me. Because of the two things above I would present the URLInput as the first thing the menu item component shows, the initial state. After a link is chosen, the menu item defaults to a label editor and the link button in the toolbar will be used to access URLInput as a popover for link editing. In the mockup on the left: adding a menu item results in directly being able to search in the URLInput and have suggestions show up. Default suggestions are from recent/top pages/posts. Pasting or writing a link would change suggestion to crawled title of link. In the mockup on the right: adding a menu item results in a placeholder which has the URLInputPopover on top. This seems to be easier to implement as the left mockup requires a disconnect between the URLInput which is bounded by the MenuItem and the Popover with suggestions. |
I agree with this, but then the rest of your comment seems to contradict this point. If we take a look at how the + icon works, we can see the following flow:
The flow you propose actually changes this significantly:
It is less steps, but it changes the behavior of the inserter. The inserter never directly adds a block without first letting you choose. Adding the block immediately is going to lead to confusion as people won't expect it based on their experience with the rest of the editor. It will also lead to users often having to delete these immediately added blocks, as they might have just been exploring the UI.
Why would we have to add a hook? Is there another way to let the Navigation block define the contents of the inserter and/or extend the inserter to optionally show the Link UI?
I'm of two opinions here; The inserter is somewhat sacred and shouldn't be allowed to be changed by a plugin. The ability to change the UI of WordPress is a pretty big opportunity for developers to build amazing things. I lean slightly towards allowing developers to customize the contents of the inserter.
If we consider a Link a block, then the Link UI is still showing a list of blocks.
I actually think this creates more problems than it solves — and that removing steps in a flow isn't always an improvement. --
I think this might be the wrong way to think about it. For paragraphs and other text-focused blocks, the text is the primary focus; Adding a link is a secondary function. However, for the Navigation block the primary focus is adding a link. Writing the label first, and only then choosing a link is a confusing flow. It also requires you to type a label even if you then choose a page/post that has a title — this is going to annoy and confuse people. |
Both of my proposed solutions specifically avoid this.
I do not mean anything is sacred :) I do not want it to be sacred. I was making an argument on why the behaviour of the inserter will change if we allow it to change.
Of course there are other ways. I was simply thinking on how to not make the navigation block a bespoke solution, but something to makes heavy use of the things we have. |
I see the logic behind both of these arguments. Thanks for articulating them so clearly. With a situation like this where there are two opposite views, I can't help but feel like interactive prototypes showing both of these approaches would be a great way to test this without the large upfront investment required to actually go through the process of developing them in code. We could then throw these prototypes over to the community and ask for user testing. What works for users and feels best is the goal right? As mentioned noting is sacred and developer hours are costly in terms of time vs a throwaway prototype. Have we ever used such an approach before? Would we be in favour of exploring this as a way of coming to a conclusion? Do we have any community members who can function as testers? |
I totally agree however that testing this with real users is how we'll get to a decision. I don't think that we've ever built out two alternate approaches before. Typically our approach is to keep development costs low, encourage experimentation, and discourage sacred cows. For example, the interface for inserting a block went through several drastic iterations in 2018. In other words: I'd suggest we put one of these approaches into |
Thanks for the discussion everyone. There are some good points being shared already, though I think we are conflating a few things. Choosing a menu item is the primary interaction of this block, and should be optimized for that (the label is subordinate); at the same time, the navigation block currently only supports a single block and should work as any other parent-child block set (no custom inserter). The (+) should indicate "here you can insert blocks", the only operative difference is if there's only one block to be added, in which case we'd insert it directly. This is orthogonal to this issue specifically, as it's going to be a standard behaviour for blocks that only support a single type of child. It's very important to separate inserting a block from choosing a link property (page, post, category, custom link) because that's how we end up with ad hoc interfaces. In the future we might also support more blocks within navigation menu — like "social icons", "search", and so on. The actual pages, posts, etc, are not blocks, they are the content of a block called "Menu Item" or "Link". Making the "choose a link" the primary interaction compared to customizing the label is totally fine, and we should explore how that UI looks once the block is inserted — could be opened and focused by default, the actual label could read "Choose a Link" or similar in placeholder state. |
URLInput
for adjusting where the menu item links to.The text was updated successfully, but these errors were encountered: