Menu item that doesn't link to a page is not rendered as the rest of the links

I would like to have a menu item that doesn’t link to a page in order to put child pages underneath it. This seems to be possible by creating a menu item and setting the link to “<nolink>”. However, in this case the styling appears to be wrong:

Screenshot 2020-04-21 at 11.01.09

Is this not supported with the CERN theme?

Thanks,

Hello Tom,

What is the use case that you want a menu link not being a link?

Doing that creates inconsistencies because you will have a 1st level menu like:

HOME: link
BANDS: link
TEST: not a link
SOMETHING ELSE: link

so the users will not know which one is a link and which one is not. What I do when I do not have a page to link to, I just link to one page from the submenu that is the most relevant.

For example If you have:

-- BANDS
---- ALL BANDS
---- ROCK BANDS
---- JAZZ BANDS

you can link both BANDS and ALL BANDS to the same page.

Let me know what you think of it.

Konstantinos

Hi Konstantinos,

I would only use this for menu items that have children, so hovering over them reveals the sub menu. Not sure then that it would be confusing to users, this is quite a common interface paradigm.

Linking to one of the pages would be an option, of course. But it is not always as obvious as in your example that there is a single “default”.

I managed to sort of fake what I want by linking to “#”. The only issue is that clicking the link then reloads the current page. See the “Events” menu item on:

https://club-musiclub.web.cern.ch/

To me, as Drupal supports <nolink> then this is a bug with the CERN theme. Looking at the source code, if the menu item is a link then you have:

<ul class="nav navbar-nav">
    ...
    <li class="dropdown">
        <a href="/link" class="dropdown-toggle">Text<span class="caret"></span></a>
        <ul class="dropdown-menu">
            ...
        </ul>
    </li>
    ...
</ul>

While if it is a <nolink> you have:

<ul class="nav navbar-nav">
    ...
    <li class="dropdown">
        <span class="dropdown-toggle">Text<span class="caret"></span></span>
        <ul class="dropdown-menu">
            ...
        </ul>
    </li>
    ...
</ul>

So the only difference is the replacement of the a tag with a span with the same class.

In the CSS the styles are applied to body header .nav > li > a which should be relatively simple to extend to also support the span.

Thanks,

Hello Tom,

You are right on that so I created a Gitlab ticket to be deployed in the next patch version of the theme.

Konstantinos

Hi Konstantinos,

Thanks for following this up.

Cheers,

Hello Tom,

I applied a fix to the issue you mentioned. The following screenshot shows how menu items that are not links (last item of the menu) will be displayed starting from v2.6.4 of the CERN Theme.

Thanks for reporting this.

Konstantinos

Hi Konstantinos,

Thank you for the quick follow up. When will the v2.6.4 of the CERN Theme be released and how do I upgrade to it?

Thanks,

Hello Tom,

I don’t know exactly when, most probably in the next few weeks. If you are an admin in the website you will get an e-mail when the deployment is applied. It is also announced in the Announcements section of the forum.

You dont need to do anything on your side since the Drupal infrastructure is centralised and when the theme is updated, the update is applied in all websites.

Let me know if you need something more.

Konstantinos

1 Like