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: Create first menu seamlessly #47058

Closed
scruffian opened this issue Jan 11, 2023 · 5 comments · Fixed by #47684 or #48698
Closed

Navigation: Create first menu seamlessly #47058

scruffian opened this issue Jan 11, 2023 · 5 comments · Fixed by #47684 or #48698
Assignees
Labels
[Block] Navigation Affects the Navigation Block

Comments

@scruffian
Copy link
Contributor

What problem does this address?

When my navigation block is in a "fallback" state, and then I add a link to it, I see a spinner and I get snackbar notification telling me that a new navigation menu has been created. This is very confusing - I already have a menu don't I??!

What is your proposed solution?

Some options:

  1. Always create a navigation menu CPT when a navigation block is inserted
  2. Create the navigation menu CPT behind the scenes in a silent manner, and disconnect the UI from the database until it has been created.
  3. Add a notification to explain what is happening so that users understand
  4. Create a navigation menu CPT for all sites even if they don't have a navigation block yet
@draganescu
Copy link
Contributor

Should we try to

  • optimistically update the UI without the need for spinners and loading indicators
  • silently create the menu

@SaxonF
Copy link
Contributor

SaxonF commented Jan 12, 2023

From a UX perspective there isn't much difference between those approaches as all the complexity should be hidden behind the scenes. It should just feel like you're adding to or updating an existing menu. Let me know if I can help with this one at all but sounds like it's a technical decision.

@draganescu
Copy link
Contributor

draganescu commented Jan 30, 2023

In a discussion with @scruffian this idea came up:

What if we always create a navigation menu post

Instead of having to deal with spinners and weird undo situations (see #46476) we just follow this simple rule. This way the navigation block would be updated so that it: always creates a wp_navigation post:

  • when there are no classic menus and no block menus, create a wp_navigation post with a page list block in it. Being the only one the block will use it. Create this both when rendering an empty block, or when 1st opening it.
  • when the theme puts in a template part a navigation block with inner blocks, create a wp-navigation with the inner blocks in it.

In all cases, update the navigation block ref silently and save the template part or post also silently, creating a really seamless experience.

@getdave
Copy link
Contributor

getdave commented Apr 19, 2023

This was never completed but may be addressed by #48698.

More context at #48698 (comment)

@getdave
Copy link
Contributor

getdave commented Apr 21, 2023

This was completed as a result of #48698 which will now always create a fallback menu for a user unless there are uncontrolled inner blocks present. This means that we should now rarely see the (jarring) state where the block transitions from uncontrolled to controlled.

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
Projects
None yet
4 participants