Disabled link selected by MenuActiveTrail even though enabled menu item is available

Created on 5 July 2016, about 8 years ago
Updated 15 March 2023, over 1 year ago

Problem/Motivation

MenuActiveTrail selects the first menu item that is returned by MenuLinkManager::loadLinksByRoute. This results in the menu system potentially selecting a disabled menu item, even if an enabled item is available in the menu, but comes later in the link list.
Therefore, a path that does have an active menu item may not be presented to the user in the menu at all, as the disabled item was picked by the system.

Steps to reproduce

1. Create two menu items to the same path or content
2. Assign them increasing weights
3. Disable the first item.
4. Navigate to the linked path or content

Result: The first menu item will be picked.

Expected behavior

As an active menu item is available, the first such link (2nd link in our example) will be set active.

Proposed resolution

Adjust MenuActiveTrail::getActiveLink to check the enabled state of the menu links with a fallback.

🐛 Bug report
Status

Needs work

Version

10.1

Component
Menu system 

Last updated 1 day ago

Created by

🇩🇪Germany ckaotik Berlin

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024