-
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 menu block: Visual styling #13791
Comments
After some initial sketching, I explored three different directions for the visual display of the selected menu and menu items. These mockups are still a bit rough and could use finessing once we determine a solution. The aim here is to map the selected state of the menu as closely as possible to the front-end output so that users can easily understand what they're building and how it will look on their site. This presents some tricky scenarios, most notably with regards to horizontal vs vertical menus. I've shown both horizontal and vertical menus here, and I'm a bit torn about how best to approach these. In the context of a full-site editor, it would make sense for the selected state of the block to match the frontend output, and it would also make switching focus less jarring and jumpy. That said, changing the layout between horizontal and vertical menus introduces a lot of complexity, especially for multi-level menus, and forces users to learn a slightly different model for building their menus, which may not be ideal. There's also the reordering of items to think about: our current Gutenberg patterns allow for this in an up-to-down way, but not so much in a side-to-side way. Introducing a new pattern here, even if it's just a change in orientation, may introduce cognitive load to an already complex task. In all of these explorations I've defaulted first to a horizontal menu, since that's the more common usage. I think a horizontal setup could work even on smaller screens (or with larger menus) by fading and then scrolling horizontally: I've also included:
I've also experimented a bit with shifting the [+ Add new item] button depending on the selected menu item, so it's easier to add an item where you want, rather than being forced to add them at the bottom of the page. Again, there are pros and cons to this approach, so it's worth discussing in a bit more detail. LinksThis concept uses plaintext links and a child-block model to surface individual menu items settings: Pros:
Cons:
ChipsThis one borrows from Material Design's input chip pattern to represent complex information in a compact form: Pros:
Cons:
BlocksThis one represents navigation items as blocks and simplifies the selected state down to the bare minimum: Pros:
Cons:
Your thoughtsI'd love some feedback before exploring further:
|
I think Blocks is the clearest, though also visually the heaviest — might want to explore alternate block colors and borders. In terms of flexibility, the Links option feels the most extendable and the most neutral of all the options. I imagine in the future, themes that embrace editor styles will have custom styles for this block, and we need to create something that's going to still make sense in those cases.
What does selecting a child menu item look like? |
I'm definitely leaning toward the Blocks treatment, although I agree with you on the heaviness. I've tried lightening it up and applying a selected/edit state more closely aligned with explorations in #13790: My concern with the light grey is that it's similar to the visual styling used for placeholders. I'll experiment with a few different solutions here.
Pretty weird right now, although I'm going to blame Figma and/or my lack of Figma knowledge: (These elements should definitely be properly aligned!) I'll add this to my list to explore a bit more as well. |
I think that's definitely getting closer. I wonder if the up/down arrows in the move & drag tool should be left/right on horizontal menus? |
I'm most drawn to the Links variation personally. I appreciate the barebones quality of it, and it's similar visually to other parent/child block situations we're using today. I also really like that it's the least prescriptive from a styles perspective (which I think sets us up well for theme styles later on).
Menus across the web look and behave very differently. Once themes begin styling this block, I imagine we'll see a lot of variations. Once we move into full-site editing, some themes will likely want to drastically change the menu's appearance on mobile vs. desktop, some will want to expand all menu items, some will want to use dropdowns, etc. It's bound to get very complicated. Anyway — given that, I do think we have some wiggle room here in terms of how closely the selected state maps to the front end view. We should feel free to move a bit away from a 1:1 representation while in editing mode in order to make interaction a bit easier (we're doing that a bit in In #9628 for example). In that vein, have we considered having the deselected state be a super-plain Links-style version, but then switching to something like Chips or Blocks when the block is selected? It might be a bit of a jump, but it could help make editing more consistent. |
Wow. First, great work on putting this together! This is some serious progress in moving this challenging issue forward. Really loving what has been shown so far. As I've dove into this problem over the past year, I often come up feeling overwhelmed, thinking that we have to solve all the problems that arise off the bat. The work that you've shown here addresses many of the issues that could arise. However, I think it's ok to say that we can do this work with limitations. If we can make a decent nav menu that is useful in a lot of cases, then we'll have been successful. For instance, even in deciding the visual style, we can make the tradeoff of having almost no styling in Gutenberg, and letting the themes decide, or we can go in relatively opinionated and let the themes override it if they see fit. The win here is making a visual style that works most of the time for a good number of websites. We don't necessarily need to solve a triple or quadruple dropdown, or figure out how mega menus would work. That could come later, or not at all. That's why this is WordPress, if it doesn't make sense to make a mega menu (just picking on this example), I'm sure someone can make a custom block for it. As to the three options presented:
Overall any of these options feels like they could work. I'm still not sure if the process of using this will feel intuitive, and guessing a clickable prototype will solve that. Regardless, I'd feel comfortable seeing any of these taken to the next level of fidelity to play with. |
The block option seems the most sensible to me at first sight because of the different built-in features we get for free. Improvements to selections, re-aranging, border styles can be explored for the innerBlocks. Also the block option is the best because of its flexibility. How can I add the search block in a menu if it's not using innerBlocks? how can I add a static text to a menu?... |
Since design explorations have largely concluded here, I'm closing this ticket as non-actionable, and we can loop back to #13690 or new issues for any further conversation that comes up as development work progresses. Thanks everyone for all the feedback! 🙌 |
This is intended to splinter conversation from #13690 and allow us to focus the conversation on one part of the problem at a time. We'll loop back to the tracking issue when we've determined a path forward. For this issue, we're focussing on visual styling:
How are menus and menu items presented visually?
The text was updated successfully, but these errors were encountered: