Problem/Motivation

The "Side Navigation" block has an option to "Expand all menu links". The expectation is that upon selecting this checkbox, any sub-menu items will become visible in the side navigation. The actual behaviour is that only 1st-level menu items remain visible, even if navigating to the pages of levels 2, 3 or deeper, only the level 1 menu link remains visible.
The only way to solve this issue currently is to manually navigate to the Primary navigation menu and edit every menu link, selecting the "Show as expanded" checkbox.

This is how Side Navigation block is configured at the time of issue observation:
Block configuration options

Below is the screenshot of a page, attached as Level 3 menu link, which outlines the problem.
Level 3 page not reflecting in the side navigation menu

Steps to reproduce

Install the vanilla Drupal site and follow the steps to activate the CivicTheme.
Create 3 or more pages and add them to the Primary Navigation menu via the node form. Ensure they are chained together as child/parent. Example menu structure:
- Level 1 page
-- Level 2 page
--- Level 3 page
---- Level 4 page

Navigate to the frontend and only the Level 1 page menu link is visible. Navigate to all of the pages one by one to see that only the Level 1 page link is showing in the Side Navigation block.

Proposed resolution

Upon saving of block configuration, all current and future menu items become expanded and visible in the side navigation. Upon deselecting of that same checkbox, the behaviour reverses.

Remaining tasks

TBD

User interface changes

TBD, but none expected.

API changes

None expected.

Data model changes

None expected.

Comments

ivrh created an issue. See original summary.

ivrh’s picture

Issue summary: View changes
StatusFileSize
new1.31 MB
new310.49 KB
ivrh’s picture

Issue summary: View changes
alex.skrypnyk’s picture

Assigned: Unassigned » joshua1234511

The "Side navigation" UIKit component is currently powered by the "Primary menu" Drupal menu. This menu also powers the "Primary navigation" UIKit component (in the Header component).

The "Show as expanded" checkbox on each menu item should be respected in the "Primary menu" in cases where sub-trees should not be visible.
This issue is about whether this checkbox should be respected or ignored completely in the "Side navigation" component, because, bey definition, the side navigation is expected to allow to drill-down to the menu item that points to the current page (if the page is in the menu, of course).

The solution here is to keep respecting individual values of "Show as expanded", but override them all if "Expand all menu links" item is provided in the block.

For this to work, we need to get the value of the "Expand all menu links" on the menu block and pass it to the Drupal's preprocessing of the menu items to mark them all as expanded.

fionamorrison23’s picture

Issue tags: +civictheme-release-1.8
fionamorrison23’s picture

fionamorrison23’s picture

fionamorrison23’s picture

  • 9fba2943 committed on 1.x
    Issue #3421251 by joshua1234511, alex.skrypnyk: Navigation sidebar not...
alex.skrypnyk’s picture

Assigned: joshua1234511 » sonam.chaturvedi
Status: Active » Needs review
sonam.chaturvedi’s picture

Assigned: sonam.chaturvedi » alex.skrypnyk
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new2.07 MB
new2.08 MB

Verified and tested on 1.x-dev

Testing Results:
1. Upon selecting 'Expand all menu links' checkbox in the "Side Navigation" block, all sub-menu items are visible in the side navigation - PASS
2. Upon unselecting 'Expand all menu links' checkbox in the "Side Navigation" block, individual values of "Show as expanded" is respected - PASS

Screenshots:
Selecting 'Expand all menu links' checkbox
test

Unselecting 'Expand all menu links' checkbox
test2

alex.skrypnyk’s picture

Assigned: alex.skrypnyk » joshua1234511
Status: Reviewed & tested by the community » Needs work
Issue tags: -civictheme-release-1.8 +civictheme-release-1.7

We have identified that we also need to apply the same behaviour to the Mobile navigation.

sonam.chaturvedi’s picture

Assigned: joshua1234511 » alex.skrypnyk
Status: Needs work » Reviewed & tested by the community
StatusFileSize
new554.24 KB
new160.44 KB

Verified and tested on 1.x-dev

Testing Results:
1. When ‘Show as expanded’ is unchecked for L1 / L2 menus, the child menu items are not displayed on mobile. - PASS
2. Works fine on desktop - PASS

Screenshots:

‘Show as expanded’ is unchecked
test be

The child menu items are not displayed
FE menu

alex.skrypnyk’s picture

Status: Reviewed & tested by the community » Fixed

Implemented, tested, merged and will be released in 1.7.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.