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

Mark invalid menu items in Navigation editor and block #23573

Closed
Tracked by #29102 ...
tellthemachines opened this issue Jun 30, 2020 · 12 comments
Closed
Tracked by #29102 ...

Mark invalid menu items in Navigation editor and block #23573

tellthemachines opened this issue Jun 30, 2020 · 12 comments
Assignees
Labels
[Block] Navigation Affects the Navigation Block

Comments

@tellthemachines
Copy link
Contributor

tellthemachines commented Jun 30, 2020

Is your feature request related to a problem? Please describe.

In the nav-menus.php admin section, invalid menu items are flagged with a red background and an error message appears:

Screen Shot 2020-06-30 at 1 29 43 pm

The Navigation screen should also have something like this.

(An invalid menu item can be created by deleting the page a menu item links to.)

Describe the solution you'd like

Show an error message in the Navigation screen when there are invalid items, and indicate within the menu which items are invalid.

Whatever way we find of showing invalid menu items should perhaps also be applied in the Navigation block itself.


Details from #34818

A nav menu_item object returned from calling wp_setup_nav_menu_item. This object contains a property called _invalid. It is used for the following.

Whether the menu item represents an object that no longer exists.

A menu item can be invalid for the following reasons.

  • Linked post is post status trash
  • Linked term does not exist
  • post_type_archive post type doesn't exist.
  • Taxonomy archive, taxonomy doesn't exist.

The new navigation editor should handle this case. See the existing menu screens.

Screenshot 2021-09-14 at 18 29 03

Screenshot 2021-09-14 at 18 29 22

Related: #34670

@tellthemachines tellthemachines added Needs Design Feedback Needs general design feedback. [Block] Navigation Affects the Navigation Block [Feature] Navigation Screen labels Jun 30, 2020
@tellthemachines tellthemachines added this to Inbox in Navigation editor via automation Jun 30, 2020
@tellthemachines tellthemachines moved this from Inbox to Design in Navigation editor Jun 30, 2020
@enriquesanchez enriquesanchez added the Needs Design Needs design efforts. label Aug 18, 2020
@enriquesanchez
Copy link
Contributor

I agree these error messages should also appear on the Navigation screen. As for indicating an invalid block, we currently have the invalid content status for blocks, but I'm not sure it'll serve the same purpose here.

Screen Shot 2020-08-18 at 11 15 50

@enriquesanchez
Copy link
Contributor

Here's an idea of how these error messages could look on the new navigation screen.

Given how small of a space we have for child items of the navigation block, I thought about adding a distinct error highlight that lets you make a correlation between the error notice and the specific block. The errored block is also highlighted in the navigation list on the right.

Layout1

Once you select the errored block, the toolbar can describe the error in more detail and offer a way to fix it:

Layout2


I also thought about how we can avoid getting to this state in the first place. I wonder if I should be able to delete a page without seeing some sort of warning that the page I'm about to delete is being used in my navigation?

Maybe if I really wanted to delete it, I could right then and there decide to also remove it from the navigation?

@shaunandrews Since you've been working on navigation a lot lately, I'd love to hear what you think.

@jasmussen
Copy link
Contributor

Does the presence of a "Page List" block change the equation here?

The way I see it, the Page List is the solution to menu items staying in sync. As soon as the Page List block is converted into a list of individual menu items, they are essentially "just" normal hyperlinks. It would be nice with a "dead link checker" tool for such links, but it seems less urgent once the Page List block keeps things in sync automatically.

@tellthemachines
Copy link
Contributor Author

Posts can also be deleted though, or categories. If we're aiming for feature parity with nav-menus.php we still need this feature.

@draganescu draganescu changed the title Invalid menu items in Navigation screen and block Mark menu items in Navigation editor and block Feb 18, 2021
@draganescu draganescu changed the title Mark menu items in Navigation editor and block Mark invalid menu items in Navigation editor and block Feb 18, 2021
@jasmussen
Copy link
Contributor

A setup state recently landed for menu items:

setup state

This setup state essentially handles "incomplete items". Currently, items without a link.

But we are discussing in #29417 (comment) whether it could also be used to handle draft pages.

It seems like the same pattern could be extended to invalid items:

Screenshot 2021-03-05 at 11 34 57

The genesis of the idea was #28440 by @shaunandrews. In all cases, the key behavior, outside of the block-UI-like button, is that you cannot edit the title of the menu item until the item has been handled. That affords us the entire clickable area to invoke a popover where you can publish/repair/fix the menu item. I would encourage looking at Shaun's mockups in 28440, as they will very probably scale well to this.

What do you think?

@shaunandrews
Copy link
Contributor

image

Perfect.

@priethor priethor added this to To do in Navigation block via automation Apr 23, 2021
@vcanales vcanales self-assigned this May 5, 2021
@vcanales vcanales moved this from 📥 To do to 👀 PRs needing review in Navigation block May 11, 2021
@tellthemachines tellthemachines moved this from 👀 PRs needing review to 🏗️ In progress in Navigation block Jul 8, 2021
@getdave
Copy link
Contributor

getdave commented Aug 23, 2021

Screen Shot 2021-08-23 at 11 15 29

Just noting that this is still not handled by the Nav Editor screen. Added to the tracking issue #29102.

@getdave
Copy link
Contributor

getdave commented Jan 27, 2022

@jasmussen Is this still something we are going pursue?

@vcanales
Copy link
Member

vcanales commented Jan 27, 2022

@getdave @jasmussen If so, this PR is ready for review again. It has an approval, but it was granted way too long ago.

@tellthemachines
Copy link
Contributor Author

Yes, this needs to be done for feature parity with classic menus, and for better UX.

@getdave
Copy link
Contributor

getdave commented Jan 28, 2022

Ok it's added to the new tracking issue.

@jasmussen jasmussen removed the Needs Design Feedback Needs general design feedback. label Feb 7, 2022
@vcanales
Copy link
Member

Closed by #31716

Navigation editor automation moved this from Design to Done Mar 14, 2022
Navigation block automation moved this from 🏗️ In progress to ✅ Done Mar 14, 2022
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
Development

No branches or pull requests

7 participants