Problem/Motivation
It is not possible to navigate to level 1 menu items (secondary items) if they have children (level 1 is referring to the code level which is 0 indexed, 0 being the top level). The user must navigate to the level 2 menu item first (tertiary item) then back up a level via the breadcrumb.
Examples
Contrib: Simple Blocks
The Simple Blocks
menu item is a child of Structure > Block Layout
. Thus the Block Layout
page can't be reached anymore!
Contrib: Paragraphs
Paragraphs module adds the menu items Structure > Paragraphs > Add paragraph type
, where the menu item Paragraphs
leads to the paragraphs overview page which now can't be reached anymore.
Steps to reproduce
- Install drupal 11.x (via simplytestme)
- Login as admin
- Enable navigation
- Try to click on
Structure > Display modes
, which does not bring you to its menu item link/admin/structure/display-modes
Proposed resolution
When a secondary menu link has children, the child list of menu links should be preceded by an "Overview" link. The "Overview" link should link the user to the secondary menu link. The rest of the secondary menu links' children are listed below the "Overview" link.
Figma: https://www.figma.com/design/VCPAxetieAC2pzw7hgX3ij/Drupal-Admin-UI---De...
Note that the word "Overview" is still under consideration. Looking to resolve that before we finish up here. Other candidates currently include "See All".
Also, keep in mind that it's likely we'll add support for a fourth level of links. That is the subject of #3425084: Support Deeper Navigation Levels. It's equally likely that the "Overview" link implemented here for the second level, will carry forward to the tertiary level if applicable as well.
Remaining tasks
☐ Decide on UX alternatives to "Overview", or settle on itAdd overview as per "User Interface Changes" below. Anything else via follow-ups to not let perfect be the enemy of good here.- ☑ Implement the approach shown in the above screenshot as well as the Figma.
Outstanding Merge Requests
MR 10900 implements the Overview links with additions to the render array returned by the build()
method in NavigationMenuLinkTree. This MR needs test coverage.
MR 12148 implements the Overview links with a new menu manipulators service NavigationMenuLinkTreeManipulators in the navigation menu. Adding the links with a menu manipulator provides additional options to contrib and custom modules that may want to alter the overview links, either by:
- decorating the manipulator service or altering the service in a service provider
- implementing
hook_navigation_menu_link_tree_alter()
- implementing
hook_block_view_alter()
or its variants
MR 12148 has unit test coverage for the manipulator service and kernel test coverage for the navigation menu block output, though if the approach in MR 10900 is preferred, presumably the kernel test coverage can be ported there.
Neither MR currently seems to support the addition of overview links at a third level (or beyond), which would need to be a consideration for #3425084: Support Deeper Navigation Levels, depending on which issue moves forward first.
User interface changes
When secondary menu items have children, precede the child menu list by an "Overview" link that take the user to the second level menu link.
Introduced terminology
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
Users can now directly navigate to secondary menu items directly from the navigation.