Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Quark: Dropdown menu, make top-level 'non-clickable'

Solved by pamtbaau View solution

Started by Andrew Bernard 6 years ago · 3 replies · 1217 views
6 years ago

Using theme Quark, how would I make a top-level dropdown menu non-clickable?

All help appreciated! [And why is this hard - it seems to be a basic usability requirement.]

last edited 08/20/20 by pamtbaau
6 years ago Solution

@andro, To make a toplevel dropdown menu item non-clickable in theme Quark, you can do the following:

  • Create an inherited theme based on Quark. See Theme Inheritance. Using the cli is the most easiest procedure.
    If you don't create an inherited theme, you will lose all changes when Quark gets updated.
    I'll asume you named it 'mytheme'.
  • Copy file user/themes/quark/templates/macros/macros.html.twig into folder user/themes/mytheme/templates/macros/
  • In the copied file, replace lines 6-13 with:

    TWIG
    {% if p.children.visible.count > 0 %}
    <a class="{{ active_page }}"> {# Without 'href' it doesn't do anything #}
      {{ p.menu }}
    </a>
    
    <ul>
      {{ macros.nav_loop(p) }}
    </ul>
    {% else %}
    <a href="{{ p.url }}" class="{{ active_page }}">
      {{ p.menu }}
    </a>
    {% endif %}
    

The toplevel menu item will now be unresponsive and only shows its child pages.

And why is this hard - it seems to be a basic usability requirement.

It is a design choice of the devs. Some want it to be clickable, other don't. They could have make it an option in the theme though.

👍 4
6 years ago

@andro, Any luck yet in making the top-level menu-item of a dropdown non-clickable?

2 years ago

Please mark your post as solved because pamtbaau's suggestion fixes the problem. Thank you

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by FrViPofm, 2 weeks ago
4 395 5 days ago
Themes & Styling · by johan thomas, 5 years ago
1 752 2 weeks ago
Themes & Styling · by stuart young, 2 months ago
3 609 2 months ago
Themes & Styling · by Sebadamus, 2 months ago
5 622 2 months ago
Themes & Styling · by martynfoster735, 2 months ago
1 595 2 months ago