Skip to content
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 overview #17544

Closed
12 tasks done
noisysocks opened this issue Sep 24, 2019 · 10 comments
Closed
12 tasks done

Navigation block overview #17544

noisysocks opened this issue Sep 24, 2019 · 10 comments
Labels
[Block] Navigation Affects the Navigation Block [Type] Overview Comprehensive, high level view of an area of focus often with multiple tracking issues

Comments

@noisysocks
Copy link
Member

noisysocks commented Sep 24, 2019

This is an overview of the work required to complete a first iteration of the Navigation block. The block is currently in a functional state but needs lots of polish at both the block and framework level.

There's been lots of previous discussion about the Navigation block: #13690, #16821 and #16974 contain the bulk of it. As we turn our attention towards shipping a v1, let's consolidate high level discussion into this issue and more specific technical discussion into the issues linked below.

Overview

The Navigation block defines the menu area and contains all of the menu items. In its toolbar is a Navigator button for accessing the Block Navigator. Menu items are added using the mechanism for adding child blocks (+).

Each menu item is a child block. In its toolbar is a Link button for changing where the menu item links to via the existing URLInput component. Menu items can be nested within each other forming submenus. When a menu item is selected, its child menu items are displayed.

Menu items can be re-ordered using the existing block mover controls which will be restyled to look visually similar to the movers in the Gallery block.

URLInput

The URLInput component will be updated to allow the easy selection of a top-level page.

Block Navigator

Navigator

The Block Navigator will be updated to allow blocks to be re-ordered via up/down buttons.

Tasks

Future tasks

@noisysocks noisysocks added [Type] Overview Comprehensive, high level view of an area of focus often with multiple tracking issues [Block] Navigation Affects the Navigation Block labels Sep 24, 2019
@shaunandrews
Copy link
Contributor

As a way to keep the initial design and scope simple, I've come to this problem with a few initial assumptions up front:

  • Use standard/existing UI where possible.
  • Consider everything a block, using child blocks for navigation menu items.
  • Focus on a single-level navigation structure. Multi-level structures can be added later.
  • Focus on only Pages for now. Other post_type's and URLs can be added later.
  • Place move controls within menu item blocks.

With those things in mind—and knowing that these assumptions will need to change as we progress—I've worked up the following design for a very simplistic (but also very useful) Site Navigation block.

Site Navigation - Page Management Animation i4

@talldan
Copy link
Contributor

talldan commented Sep 26, 2019

Thanks for putting that together @shaunandrews, it's a really big help being able to see the whole process.

One thing that seems different from most of the discussion I've seen recently is the + button behaviour, which is in the mockup is a custom component for adding menu items.

Previously it's been discussed that this would be a normal block appender, and there's some work underway on #16708 to make the button insert the menu item directly without showing the inserter menu.

It'd be good to get a steer on which approach we want to take. (cc: @mtias)

@draganescu
Copy link
Contributor

@shaunandrews this is awesome. Thank you!

Could we explore submenus / item nesting as well? From the above it is unclear how that will work.

Also @mtias as Dan said above, that appender / inserter is its own thing, very different from the default provided by InnerBlocks, we need to reconcile somehow these differences between the niceties we could do in the block and implementing it with generic system components.

@getdave
Copy link
Contributor

getdave commented Sep 26, 2019

that appender / inserter is its own thing, very different from the default provided by InnerBlocks

I did work some time ago in Gutenberg that allows you to create a fully bespoke appender. It's not set in stone any more. You can pass any component you like.

@mtias
Copy link
Member

mtias commented Sep 26, 2019

Good eye @talldan. I omitted discussing it in depth because I thought the flow could be easily accommodated with a small tweak: clicking the plus would always insert the menu item first, and the search interface would be invoked from the newly created item (automatically), not the + itself. Does that make sense? The only way I'd keep the + opening an inserter is if we used the actual inserter to choose among "page", "post", "link", "category" entities.

As a general guideline, the (+) should insert an item immediately or open the block inserter. We should avoid appending custom interfaces to it.

@karmatosed
Copy link
Member

karmatosed commented Sep 27, 2019

I spent some time collating the current state of navigation into a single Figma file (I will try and keep this up to date). https://www.figma.com/file/cUho7Ont8qqJN06hr8z9Wp/Navigation-Story-So-Far?node-id=3%3A3

It's super rough and involves a lot of Frankenmocks, but it's a good check.

First, the separate parts:

Navigation parts

Note, right now we don't have a decent mock for nesting so that needs to come.

Here are the current mocks being iterated on:

Mocks collection_ navigation block

Mocks collection_ customization

I also did a rough collection of every state of the block (not including customization). Note the design is to be iterated but think of it as showing sketch structure for now.

Mock actions_ designs unfinished

A final collection is the current state of the simplified block being explored by @shaunandrews:

Simple proposal

@shaunandrews
Copy link
Contributor

shaunandrews commented Sep 27, 2019

As a general guideline, the (+) should insert an item immediately or open the block inserter. We should avoid appending custom interfaces to it.

I can update the design to match this, but I'm curious why? Adding the menu item immediately means that users then have to delete it (which can be confusing) if they choose to not add a new menu item. To me, this discourages the behavior of exploring how the block works, and mixes up the defined pattern for the + button elsewhere.

@karmatosed
Copy link
Member

I sort of fall in the camp of the '+' icon inserting menu item first. That said, there is some exploration with the link interface will tie back to this.

For me the current flow makes sense to simplify into this:

  • Toolbar: navigator (outline of navigation), name of navigation (able to drop down to change to existing pre-made navigation), add link.
  • In the actual block the links and ability to '+' a link.

I am not convinced we even out of box need 'more' or other things in toolbar. I know discussion has been around having toggles/formatting there. I think if we can get a simple prototype that will come.

For example (I left more just incase):

Frame

If we all agree on that we can then move into exploring a few things we need to:

  • Link interface: explored but needs final direction.
  • Nesting: not fully explored yet.
  • Customisation: explored but needs final direction.

On those things, I am also going to look at making summaries like this because I feel checking in on the states will help us move forward.

@karmatosed
Copy link
Member

Adding some latest images of link interface here:

image

Customization:

image

@noisysocks
Copy link
Member Author

Closing this out as the MVP described in the issue has shipped in Gutenberg 7.0. Follow-up issues can be found using the [Block] Navigation label or the Navigation block project board. A huge thank you to everyone here for all the hard work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block [Type] Overview Comprehensive, high level view of an area of focus often with multiple tracking issues
Projects
None yet
Development

No branches or pull requests

7 participants