Problem/Motivation

No "active-trail" class exists in ultimenu menu links.
Steps to reproduce:

  • Add an ultimenu menu to your site.
  • Click a link on the menu you created.
  • Check for the "active-trail" class on the link you just clicked. It will not be there.

Proposed resolution

Add "active-trail" class to clicked links. For reference behavior see how the built-in menu or menus created with menu block behave.

Comments

illeace created an issue. See original summary.

illeace’s picture

StatusFileSize
new810 bytes

Here is a quick-fix module that I created that adds the active-trail using a function from the menu block module.

illeace’s picture

Assigned: illeace » Unassigned
Status: Active » Needs review
StatusFileSize
new2.21 KB

Here is a patch that fixes the issue the same way menu_block does. In fact, I literally copied and renamed the function from menu_block that they use to add the active-trail data to the $tree data.

gausarts’s picture

Status: Needs review » Postponed

Thanks for contribution. Please allow some delay to get back on this.

The reason active-trail is not there, because it has active class which I thought enough to mark it active.
Also all menu children are Ultimenu regions, and they are always visible all the time.

However I am happy to include your patch as I can see possible use cases with sub-menus within.

illeace’s picture

Active trail is useful when you have two menus -- a primary and a secondary. For example, let's say your main menu has a "Products" option which is an ultimenu with several products listed. If you pick an option from the ultimenu, let's say "Toothpaste", it takes you to the toothpaste page. The toothpaste page shows the main menu with the Product option as well as a secondary menu that has all of the products listed: toothpaste, shampoo, sunscreen, etc.

In this scenario, the "Toothpaste" option from the secondary menu is the active page and will have an "active" class. However, you may want to style the "Products" option on the main menu to indicate you are in the products section of the site. Products is not active, so it won't have the "active" class. Since Toothpaste is a child menu item of Products, it is part of the menu trail for the current page. That is what the "active-trial" class is for. This patch will ensure that an ultimenu that is a parent menu item to the current page has the active-trail class.

gausarts’s picture

Status: Postponed » Closed (outdated)

Truly sorry for terrible delay. I no longer use this branch anywhere, the initial sites using this module have been migrated to WP for quite a while.

I did try to apply your patch just now, unfortunately no longer applied.

Feel free to re-open and update your patch if you are still interested to get this in. Until then I am closing this as this is now beyond me.

Thanks!

gausarts’s picture

Status: Closed (outdated) » Active

Hang on there!

gausarts’s picture

Status: Active » Fixed

Committed, anyway. Thank you for contribution!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.