MenuActiveTrail should ignore disabled menu links

Created on 17 May 2018, over 6 years ago
Updated 16 February 2023, over 1 year ago

Problem/Motivation

The core system for retrieving the active menu trail does not check if the matching menu link is enabled or disabled. This can lead to several problems when a menu link is disabled, such as an "active" class inappropriately set on a parent menu link, or a wrong breadcrumb if Menu Breadcrumb is used.

A similar problem can happen if the matching menu link is active but one of its parent links is disabled. But:
* this would be a very strange use case,
* I don't know what we should expect from such a configuration,
* in that case, the problem could be easily avoided by also disabling the matching menu link,
* handle this would require to load all the parents to check if they are enabled, which might harm performance.

So I guess we only need to handle the case where the matching menu link is disabled. Here's a patch.

Steps to reproduce

Proposed resolution

Remaining tasks

Review
Commit

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

🐛 Bug report
Status

Needs work

Version

10.0

Component
Menu system 

Last updated 1 day ago

Created by

🇫🇷France GaëlG Lille, France

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.

  • 🇺🇸United States smustgrave

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.

    Seems there was a test failure in the MR.

    Hiding patch as fix is in MR.

  • 🇮🇳India mohit_aghera Rajkot

    I tried to reproduce the issue manually using following approach:
    My menu tree looks like given below
    - Home
    - Parent (path: node/)
    --Node 1 (active) (path: node/1)
    --Node 2 (disabled) (path: node/2)

    Now when I visit node/2 in the browser directly, i can see proper menu tree in the UI
    Besides, I don't see any `is-active` class applied to Parent or Home menu links.
    Can we get additional steps to reproduce the issue.

Production build 0.71.5 2024