Menu level-0 item shortcomings

Created on 9 December 2024, 13 days ago

Problem/Motivation

I think the menu has the following shortcomings for level-0 items:

  • For the desktop 'drawer' style menu: a page/link associated with level-0 menu items cannot be reached through the desktop menu.
  • For the mobile menu: a menu item that has 'nolink' set on it - and has children - has (imo) the wrong behaviour: it tries to open the 'nolink' rather than expand to show the next menu level.

Steps to reproduce

For the desktop menu:
Create a primary menu, set a link on a 'top level' element. Set the primary menu to style 'drawer'.
Click on a top menu item: it shows its sub-menu but does not open the associated page.

For the mobile menu:
Create a menu item with 'nolink' (in brackets) set. Create 'next level' menu items under the 'nolink' menu item.
Open the menu on a mobile phone.
Select the title of the 'nolink' item: it doesn't open to show the next level of that menu item (this is what I would intuitively expect)

Proposed resolution

For the desktop:

Separate the menu link from its collapsible icon in the twig.
Make both the anchor and the icon (or their parent elements) trigger the panel.
On 'panel open' in javascript, check which element triggered the 'panel open': if it was the anchor, load its associated page.

When somebody clicks the collapsible icon it will just show the sub-menu.
When in place, when somebody clicks the anchor it will (briefly) show the sub-menu before loading the new page.
That should (hopefully) be enough of a visual clue that the item has a sub-menu as well as a link.

For the mobile issue:

In preprocessing: find any 'nolink' URL and clear the item URL
In twig, if a menu item has no link but it has children: cause it to open the next level panel

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.8

Component

Code

Created by

🇬🇧United Kingdom mwjansen Bristol

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024