Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
There is a bug that the menu-item--active-trail
if I add my home button into a menu. It looks like this:
<ul class="my-menu">
<li class="menu-item">
<a href="/drupal8/" data-drupal-link-system-path="<front>" class="is-active">Home</a>
</li>
<li class="menu-item">
<a href="/drupal8/node-17-article" data-drupal-link-system-path="node/17">Test 1</a>
</li>
</ul>
Other items have li.menu-item--active-trail
class assigned.
<ul class="my-menu">
<li class="menu-item">
<a href="/drupal8/" data-drupal-link-system-path="<front>">Home</a>
</li>
<li class="menu-item menu-item--active-trail">
<a href="/drupal8/node-17-article" data-drupal-link-system-path="node/17" class="is-active">Test 1</a>
</li>
</ul>
Proposed resolution
Add the li.menu-item--active-trail
class also to LI elements that contain Home links.
<ul class="my-menu">
<li class="menu-item menu-item--active-trail">
<a href="/drupal8/" data-drupal-link-system-path="<front>" class="is-active">Home</a>
</li>
</ul>
Remaining tasks
User interface changes
Home links show with proper background color set in CSS.
API changes
None.
Data model changes
None.
Comments
Comment #2
hass CreditAttribution: hass commentedComment #3
hass CreditAttribution: hass commentedComment #4
hass CreditAttribution: hass commentedComment #5
star-szrCan we check that it's not a menu thing first, please?
Comment #6
hass CreditAttribution: hass commentedSure. It more likely a menu bug.
Comment #7
mikeocana CreditAttribution: mikeocana as a volunteer and at Promet Source commentedill check this
Comment #9
toomanypets CreditAttribution: toomanypets commentedComment #10
toomanypets CreditAttribution: toomanypets commentedSee #1578832-35: Class active-trail not added to li element when linking to front page for a work-around that almost works.
Comment #15
legolasboClosing this as a duplicate of #1578832: Class active-trail not added to li element when linking to front page which has been around since 2012