Improved Menu Functionality and Template Updates for Drupal Solo Theme: Horizontal, Sidebar, and Responsive Menus

Created on 6 July 2024, 3 months ago
Updated 10 August 2024, 2 months ago

In the sidebar I have menus up to the fourth level.
I noticed that the links are left aligned instead of right aligned.
https://prova.gmpe.it/biologia/trascrizione

Maybe it's better this way because the sidebar is narrow, but I wanted to point it out.

The menu closes when you click anywhere on the page, making it difficult to move to the next page.
It should close only by clicking on the next link, as with accordion, also because I always have to click on back to top, images with colorbox etc.

Thanks and best regards

๐Ÿ’ฌ Support request
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡นItaly giordy

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

Comments & Activities

  • Issue created by @giordy
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States flashwebcenter Austin TX

    Hello,

    The question was answered here: https://www.drupal.org/project/solo/issues/3439615 โœจ Enhancing Solo Theme: Integrating Fourth-Level Into Primary Menu Closed: works as designed .
    The menu is built to close when you close anywhere.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly giordy

    Thanks, I'll see the post for the fourth level menu.

    Menu closing, however, is a serious problem.
    It was my first request, because I consider the menu a fundamental part of my site.
    I had tested the code on the test site, where the pages are short and I didn't notice that it closed.
    Now that the new site is almost ready and the pages are all very long, the problem is evident. As it is, it is not accessible for navigation between pages. I have to find an alternative solution.
    Accordion menu modules exist, but they are not compatible with Drupal 10.

    Thanks and best regards

  • Assigned to flashwebcenter
  • Status changed to Fixed 3 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States flashwebcenter Austin TX

    Hello,

    I thoroughly debugged all the menus and applied this feature (click any where to close sub menus) to the horizontal main menu, the sidebar main menu, and the responsive horizontal menu. Additionally, I added padding to the fourth-level items in the side menu. I also updated all left/right side menus to use the default template (menu--primary-sidebar-menu-template-click.html.twig), so any menu inserted in the left/right side will be vertical by default, eliminating the need to create custom templates. All the updates have been pushed to the development version โ†’ .

    Best wishes,
    Alaa

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States flashwebcenter Austin TX

    The side menus on the demo site have been updated: https://unitedstarsofamerica.com/solo-settings โ†’

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly giordy

    I saw the demo site: wonderful!
    It's just what I need: understandable and navigable.

    I tried to install it, but I encounter the following problems:

    1. if I delete from the custom theme: templates/navigation/menu--biologia.html.twig, the menu returns horizontal:
    https://prova.gmpe.it/biologia/biologia

    2. the arrow indicating the presence of the submenu does not appear:
    https://prova.gmpe.it/fisica/fisica

    3. should I delete the gmpe-script.js file?

    Thanks for the great work

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States flashwebcenter Austin TX

    No, don't delete gmpe-script.js. This file is essential for keeping the side menu open. Instead, we should delete any Twig templates associated with menus on the left or right side. The error you're encountering is likely because the caches haven't been cleared.

    Remember, any changes to Twig templates must be followed by clearing the caches. On the demo site, I'm using Solo as the default theme, and I don't have any custom Twig templates for the side menus.

    Best wishes,
    Alaa

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly giordy

    Unfortunately I confirm the problems.
    - All caches have been cleared many times.
    - If I delete the twig files, the menus return horizontal, even if in the css there is:

    #page-wrapper .navigation-sidebar-template ul li.is-active > ul {
     display: block;}

    If the cause of the problem cannot be found, the menu can stay that way for now, since it works as I wanted.

    Thanks and best regards

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States flashwebcenter Austin TX

    Hello,

    I noticed that this page (https://prova.gmpe.it/biologia/trascrizione) uses two different menu Twig templates: the left side uses the default template, while the right side uses the correct one.

    Since you don't use Composer, ensure that the sub-theme doesn't include any menu Twig templates for the side menus. When updating the Solo theme, delete the old version, then download and upload the new one. Be sure to clear the caches and consider hard-refreshing your browser cache.

    Best wishes,
    Alaa

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly giordy

    It's the other way around: I have all the twig templates, except biologia. If I remove the templates, the menus become horizontal. And that's the problem.
    When I upgrade, I always delete the old folders and clear the cache.

    Thanks and best regards

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly giordy

    I tried deleting the gmpe-script.js file, but nothing changed.

    Thanks and best regards

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States flashwebcenter Austin TX

    Hello,

    If Twig debug is not active on this site, I won't be able to understand what is happening on it.

    Best wishes,
    Alaa

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly giordy

    I activated Twig development mode.

    Thank you

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States flashwebcenter Austin TX

    Hello,

    There is something on the site (https://prova.gmpe.it/biologia/trascrizione) preventing the menu from getting the correct theme suggestions. To troubleshoot this, follow these steps:

    1- Enable Twig Debug: This will help you see which theme suggestions are being used.

    2- Update Solo: Ensure you have the latest development version of the Solo theme.

    3- Disable Themes: Completely disable both the Solo theme and your sub-theme. Set Olivero as the default theme.

    4- Enable Solo Theme: Go to Structure > Block Layout and insert the menu biologia.

    Inspect the Left Sidebar: You should see the following file name suggestions (refer to the screenshot for the demo site):

    <!-- FILE NAME SUGGESTIONS:
       โ–ช๏ธ menu--biologia.html.twig
       โœ… menu--sidebar-first.html.twig
       โ–ช๏ธ menu.html.twig
    -->

    5- If you don't see this, either you didn't clear caches or you don't have the latest development version of Solo.

    6- If you see the correct debug message, then delete any twig templates inside the sub-theme and Install your sub-theme again and inspect the left sidebar. If the suggestions disappear, check gmpe.theme to ensure there are no overrides to the hook suggestions.

    Further Investigation: If you still donโ€™t see the previous debug message, something else on the site might be affecting the menu hook suggestions.

    Best wishes,
    Alaa

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly giordy

    I followed the instructions and the menu still doesn't work properly.
    I restore the previous situation and keep it like that.

    Thanks and kind regards

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States flashwebcenter Austin TX

    Hello,

    I've noticed a difference between the two menus in the Olivero theme. In my screenshot, the

      element has three classes: menu--sidebar, menu, and menu--level-1. However, on your site, the
        element only has two classes: menu and menu--level-1.


        I'm not sure if you placed the menu in the sidebar region or the content region, but if it is in the sidebar region in Olivero, something on your site might be affecting the menu hook suggestions.

        Best wishes,
        Alaa

  • ๐Ÿ‡ณ๐Ÿ‡ฑNetherlands tzsl

    Hello,
    Are you still using menu_block module.
    Maybe is the theme hook suggestion in one of the menuโ€™s wrong and suggest another theme hook than expected.

    Greetings Theo

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States flashwebcenter Austin TX

    Hello Theo,

    Thank you for your keen observation! I installed the module locally and got the same results. Your direction was spot on.

    Best wishes,
    Alaa

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States flashwebcenter Austin TX
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly giordy

    I uninstalled the module. Attached is the result.

    Thanks and best regards

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

Production build 0.71.5 2024