Skip to content

Navigation: Create first menu seamlessly #47058

Description

@scruffian

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

Activity

  1. added
    [Block] Navigation
    on Jan 11, 2023
  2. draganescu commented on Jan 11, 2023

    @draganescu
    Contributor

    Should we try to

    • optimistically update the UI without the need for spinners and loading indicators
    • silently create the menu
  3. SaxonF commented on Jan 12, 2023

    @SaxonF
    Contributor

    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.

  4. draganescu commented on Jan 30, 2023

    @draganescu
    Contributor

    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.

  5. getdave commented on Apr 19, 2023

    @getdave
    Contributor

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

    More context at #48698 (comment)

  6. getdave commented on Apr 21, 2023

    @getdave
    Contributor

    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

Metadata

Metadata

Assignees

Labels

[Block] Navigation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions