Why certain links(I believe they are kind of special links) like for homepage() or for the contact form page(contact) does not generate the active or active-trail class when they are active. Only their 'a' tags have the active class. This happens for the homepage link in both the main-menu and navigation while it happens to the contact form link in the main-menu but not in the navigation. Any other link like for a node or an external link have the active/active-trail class in both the 'li' and 'a' tags.

Comments

jeremycaldwell’s picture

Status: Active » Postponed (maintainer needs more info)

Have you tried using the default Bartik theme and see if it generates the active and active-trail classes on the list item or the anchor element? Give that a try and let us know if it does the same thing and be sure to use the 7.0 release of Drupal too since it's out of beta now.

916Designs’s picture

Both Bartik and Garland are setting class "active" on both the list items and the anchors, for any menu item. However, they are not setting active-trail on the "special case" links like Home and Contact.

Seems to be a bug and can of worms in core:
http://drupal.org/node/609542
http://drupal.org/node/942782

jerodfritz’s picture

I had same problem and after applying this patch (http://drupal.org/files/issues/942782-43-per-menu-preferred-link.patch) to latest Drupal (7.0) active trail worked fine on all menu items for me.

Pratheep’s picture

I'm now using the stable version of D7 and the problem still persists. I've tried Bartik and even Stark and the classes are added as expected so I guess the problem lies with Fusion. On a closer look I believe the issue is only the 'active' class on 'li'. The 'active-trail' class is applied correctly (on both the 'li' and 'a') when the link is active and it has sublinks. The 'active' class is applied correctly on the 'a' tag as well when the link is active(no matter the link has any sublink or otherwise). Summary --> No 'active' class is applied on any active 'li' at all(there should be a 'active' class even when the 'active-trail' class is present).

carn1x’s picture

Subscribing

andros’s picture

stephthegeek’s picture

Status: Postponed (maintainer needs more info) » Active

Confirmed, sort of... it's more a problem of inconsistency across menu classes in general, not exactly a Fusion thing. The difference you're seeing is primarily because core themes print $main_menu out as a variable in their page.tpl.php, whereas Fusion uses a block (for greater flexibility).

Here is the breakdown of what active menu item markup looks like in different conditions:
print $main_menu (Bartik): <li class="menu-977 last active"><a class="active" href="/">My link</a></li>
Main menu block in sidebar (Bartik): <li class="first leaf"><a class="active" href="/">My link</a></li>
Menu block in Main Menu (or any) region, no Superfish (Fusion): <li class="first leaf active-trail"><a class="active-trail" href="/">My link</a></li>
Menu block in Main Menu region, Superfish enabled*, NO child items (Fusion): <li class="middle even" id="menu-977-1"><a class="active" title="" href="/">My link</a></li>
Menu block in Main Menu region, Superfish enabled, WITH child items (Fusion): <li class="active-trail middle even menuparent" id="menu-947-1"><a class="menuparent active" title="" href="/">My link</a></li>

* Note: other classes added by Superfish (sf-) removed for clarity

I'm... not sure where the easiest place is to gain some consistency here. Haven't tried with other menu modules, like Menu Block. Superfish usage is going to be pretty common too, where we're going to run into a big problem with targeting active <li>s that don't have child items.

stephthegeek’s picture

Poieo’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

This will not be addressed by Fusion and was likely fixed by the core issue.