Menu block is never empty, region keeps showing up

Created on 31 December 2015, almost 9 years ago
Updated 19 June 2023, over 1 year ago

Hey guys

I'm running into this bug:
My main menu block is never empty, and that is why my region "sidebar" keeps showing up.

How to reproduce:
- Create menu block (header) and show top level only.
- Create menu block (sidebar) and show 2nd to unlimited level.
- Place both blocks in a region.

If my menu has child items, the child items show up correctly in the sidebar.
But if my menu does not have child items, it is visually empty, but the sidebar region is still showing.

The sidebar keeps showing up because it thinks the sidebar-main-menu is not empty.

A {{ dump(page.sidebar_first) }} in my page twig file is telling me this:

array (size=4)
  'hoofdnavigatie_2' => 
    array (size=3)
      '#cache' => 
        array (size=4)
          'keys' => 
            array (size=3)
              ...
          'contexts' => 
            array (size=2)
              ...
          'tags' => 
            array (size=3)
              ...
          'max-age' => int -1
      '#weight' => int -6
      '#lazy_builder' => 
        array (size=2)
          0 => string 'Drupal\block\BlockViewBuilder::lazyBuilder' (length=42)
          1 => 
            array (size=3)
              ...
  '#sorted' => boolean true
  '#theme_wrappers' => 
    array (size=1)
      0 => string 'region' (length=6)
  '#region' => string 'sidebar_first' (length=13)
πŸ› Bug report
Status

Needs work

Version

9.5

Component
Menu systemΒ  β†’

Last updated about 11 hours ago

Created by

πŸ‡§πŸ‡ͺBelgium yvesvanlaer

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024