Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 298730

MenuActiveTrail should ignore disabled menu links

$
0
0

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

Create menu items with this structure in the main menu:

  • Node 1 (enabled)
    • Node 2 (disabled)

Browse to Node 2 and inspect the menu markup: the Node 1 menu item has the primary-nav__menu-link--active-trail class.

Proposed resolution

Disabled menu items should not be used to generate the active trail.

Remaining tasks

Review
Commit

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A


Viewing all articles
Browse latest Browse all 298730

Latest Images

Trending Articles



Latest Images