Menublock not visible when parent items have same link

Created on 18 October 2016, almost 8 years ago
Updated 1 September 2023, about 1 year ago

E.g., following menu

lvl 1
- lvl 2
- - lvl 3

when lvl 1 and lvl 2 link to the same node, and you create a menu block which shows menu links starting on lvl 3, this block is not visible when visitting the node linked by lvl1 and lvl2 menu-item.

Steps to reproduce

  1. Install a fresh instance of Drupal 9.5.x using the standard install profile
  2. Create 3 content items (basic pages or articles), so you end up with /node/1, /node/2 and /node/3
  3. Create a menu called Test
  4. Add 4 links to the Test menu, according to the screenshot below
  5. Go to /admin/structure/block and click 'place block' in your region of choice (ie Sidebar)
  6. Choose Test - Menus as your block
  7. In the block configuration, expand "Menu settings", set "Initial visibility level" to 3
  8. (Checking "Expand all menu items" does not make a difference in the end result)
  9. Visit /node/1, /node/2 and /node/3 and notice when your menu block appears: it is only displayed on /node/2 and /node/3

Menu configuration to reproduce this issue (step 4):

🐛 Bug report
Status

Active

Version

9.5

Component
Menu system 

Last updated about 21 hours ago

Created by

🇧🇪Belgium StryKaizer Belgium

Live updates comments and jobs are added and updated live.
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.

  • 🇳🇱Netherlands tinto Amsterdam

    Triaging this issue as part of the Bug Smash Initiative .

    I've tested this on a fresh install of Drupal 9.5.x-dev and can confirm that the behavior described in the issue summary still occurs.

  • 🇳🇱Netherlands tinto Amsterdam

    Updating the issue summary with steps to reproduce, including a screenshot of the menu settings.

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India BhumikaVarshney Delhi

    Hi @tinto
    What I have noticed after following all your steps and the concern of this issue is that the parent link is not visible.
    The issue is not because menus have parent items have the same link the parent link is not visible because the "Initial visibility level" is set to 3 as per your steps.
    If we set the initial visibility to the 3rd level the menu will automatically render the 3rd child directly.
    I hope this will resolve your issue if I set the "Initial visibility level" to 1 the parent menu is visible.
    Please refer to the screenshot.
    Thank you!

  • Status changed to Active over 1 year ago
  • 🇳🇱Netherlands tinto Amsterdam

    Thank you for looking into this, @BhumikaVarshney! For the record, this is not "my" issue, but I am merely trying to determine if this is really a bug by trying to reproduce what @StryKaizer described in the original issue summary. I can confirm that I have the same outcome, so I posted clear(er) steps to reproduce this behavior.

    The issue is not because menus have parent items have the same link the parent link is not visible because the "Initial visibility level" is set to 3 as per your steps.
    If we set the initial visibility to the 3rd level the menu will automatically render the 3rd child directly.

    In an attempt to further illustrate the concern of the OP, I just extended my test menu so it looks as follows:

    - Link to Node 1
    - - Another link to Node 1
    - - - Link to Node 2
    - - - Link to Node 3
    - Link to Node 4
    - - Link to Node 5
    - - - Link to Node 6
    

    With the settings described above, the menu block does appear when you visit any link on level 2 or level 3 except for /node/1. I believe the OP expects to see the menu appear when visiting /node/1 too.

    The next step is to determine if this is actually a bug, or if this is intended behavior. In case of the latter, this issue can be marked as "works as designed". If it turns out to be a bug, we need a patch to resolve it.

    P.S. The issue status Needs review is used when a patch has been created that needs review and testing.

  • 🇮🇳India Nishant2312

    To further clarify the concern raised by the original poster (OP), I've conducted additional testing and expanded the menu structure for a more comprehensive illustration:

    - Link to Node 1
    - Another link to Node 1
    - Link to Node 2
    - Link to Node 3
    - Link to Node 4
    - Link to Node 5
    - Link to Node 6

    With the previously described settings, it's evident that the menu block appears when visiting any link on levels 2 or 3, except for the URL path "/node/1." It appears that the OP's expectation is for the menu to also display when visiting "/node/1."

    Our next course of action should be to determine whether this behavior is intentional or if it indeed constitutes a bug. If it's by design, we should categorize this issue as "working as designed." Conversely, if it's identified as a bug, we will need to develop and apply a patch to rectify it.

Production build 0.71.5 2024