Hamburger vanishes? Cause below

Created on 7 February 2023, almost 2 years ago
Updated 26 June 2023, over 1 year ago

Problem/Motivation

In the core theme & in sub-themes derived from it can happen that the hamburger icon & the ability to slide out the navigation sidebar disappears.

Steps to reproduce

Clean install of theme or after running script to install sub-theme. Remove all blocks in the region navigation, leaving the block Main Navigation in the region navigation_collapsible. After cache clear & refresh the hamburger icon is no longer rendered.

Proposed resolution

I believe when a region is empty of blocks the attached libraries are not loaded. Thus, in the [dot]theme file for the root theme or sub-theme, in the function that Implements template_preprocess_region() the switch case is attaching the library dxpr-theme-header--mobile to the region navigation & not to the region navigation_collapsible.

So adding to the code the line below my comment:

    case 'navigation':
    // GM Added here because if above region has no content hamburger vanishes.
    case 'navigation_collapsible':
      $variables['#attached']['library'][] = 'entrebahn_dxpr_subtheme/dxpr-theme-header';
      $variables['#attached']['library'][] = 'entrebahn_dxpr_subtheme/dxpr-theme-header--top';
      $variables['#attached']['library'][] = 'entrebahn_dxpr_subtheme/dxpr-theme-header--mobile';
      break;

Fixes the issue & allows either region to be empty of blocks.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

5.1

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada ramriot

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

Comments & Activities

Production build 0.71.5 2024