Link with logo and url to <front> are added on menu inside toolbar

Created on 9 May 2024, about 1 month ago
Updated 17 May 2024, 30 days ago

Problem/Motivation

I've encountered this bug using https://www.drupal.org/project/toolbar_menu, but I'm quite positive it would happen with any hook_toolbar adding a menu inside the toolbar.

Steps to reproduce

  • Configure Gin to show the site logo
  • Install toolbar_menu
  • Add a menu with the module inside the toolbar

The first item of the menu will be link a with the site logo and the url

<a href="/en" class="toolbar-logo is-active" data-drupal-link-system-path="<front>">
              <img src="/sites/default/files/site-media/logo.png" class="toolbar-icon-home" alt="Home">
</a>

This happens with both Gin Gin toolbar enabled.
With only Gin this extra link doesn't appear, nor using another theme e.g. Claro.

🐛 Bug report
Status

Closed: duplicate

Version

1.0

Component

Code

Created by

🇮🇹Italy Giuseppe87

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

Comments & Activities

  • Issue created by @Giuseppe87
  • Status changed to Postponed: needs info about 1 month ago
  • 🇨🇭Switzerland saschaeggi Zurich

    Is this reported problem already covered with https://www.drupal.org/project/toolbar_menu/issues/3271757 🐛 css class name conflict with gin theme Needs review ?

    Or maybe you can override the template for your custom menu?

  • 🇮🇹Italy Giuseppe87
    1. No, I am already using that patch. That issue is purely css, the html is correctly rendered, however the class conflicts therefore the dropdown isn't show without the patch
    2. The issue I've created is instead about markup, the code I've pointed out is actually added in the markup of the menu if gin_toolbar is enabled.
      I couldn't identify the a point in the code, but I suspect that either a preprocess or a pre_render callback actually insert that extra div with the logo
    3. Is possible override the template? I am using obliviously Gin, therefore I can't create a sub-theme where use my override twig files, which is the way I know to override other themes' templates. Is there another way to override them? For now I've hidden the extra div via css but it's a weak solution as there is no selector to identify it:
      .toolbar-menu-container {
        ul {
          li:first-child {
            display: none;
          }
        }
      }
      
  • Status changed to Active about 1 month ago
  • Status changed to Closed: duplicate about 1 month ago
  • 🇨🇭Switzerland saschaeggi Zurich

    I think this is a duplicate of https://www.drupal.org/project/gin/issues/3376559 🐛 Home link added when using Toolbar Menu RTBC so I'm closing this in favor of the one we have in Gin.

    Can you check if that MR fixes your issue and add a comment on that issue? Thank you!

  • 🇮🇹Italy Giuseppe87

    The MR of that issue is exactly the same problem I reported, and the MR seems to work fine.

    Thanks and sorry for the duplicate; I searched on the issue queue on both this module and the theme, I have no idea how could miss that issue!

Production build 0.69.0 2024