Voyager: Multilevel menu drop down bugs

Created on 30 Oct 2017  Â·  10Comments  Â·  Source: the-control-group/voyager

  • Laravel Version: 5.5.*
  • Voyager Version: dev-master
  • PHP Version: 7.1.8-1
  • Database Driver & Version: mysql Ver 15.1 Distrib 10.1.26-MariaDB

Description:

The drop down for sidebar menu only works for 2 levels menu. I tried to create 3 levels menu, but when I click the 2nd level drop down it close the 1st level dropdown.

Steps To Reproduce:

  1. Go to Menu Builder
  2. Click Builder button
  3. Create New Menu Item (Menu 1)
  4. Create New Menu Item (Menu 2)
  5. Arrange them so that it become 3 level menu
    e.g
    Menu 1
          Menu 2
                Dashboard
                User
          Database
    screenshot from 2017-10-31 03-03-06
    Uploading Screenshot from 2017-10-31 03-04-01.png…
enhancement help wanted

Most helpful comment

Here is a quick fix for this problem:
$('.panel-collapse').on('hide.bs.collapse', function(e) { if($(event.target).parent().hasClass('collapsed')) { e.stopPropagation(); e.preventDefault(); } });
I simply catched the hide event and checked if there was another closed dropdown where the user clicked. If yes the event is not further propagated.

.app-container .content-container .side-menu .navbar-nav li.dropdown li.dropdown div > ul > li > a { padding: 0 2.0em; }
This is some additional space at the left of the third level submenu.

All 10 comments

Voyager's nav menu only supports 2 levels (I feel like it's mentioned in the docs somewhere...). We're open to PRs to make it support more, but will likely not implement that ourselves due to other priorities.

Other menus will support as many as you'd like, because the CSS/JS will be up to you to implement.

Here is a quick fix for this problem:
$('.panel-collapse').on('hide.bs.collapse', function(e) { if($(event.target).parent().hasClass('collapsed')) { e.stopPropagation(); e.preventDefault(); } });
I simply catched the hide event and checked if there was another closed dropdown where the user clicked. If yes the event is not further propagated.

.app-container .content-container .side-menu .navbar-nav li.dropdown li.dropdown div > ul > li > a { padding: 0 2.0em; }
This is some additional space at the left of the third level submenu.

We're open for pull requests

Why don't we just let the user open and close the parents as he want ?

For work when you click on arrow:

$('.panel-collapse').on('hide.bs.collapse', function(e) {
    var target = $(event.target);
    if (!target.is('a')) {
        target = target.parent();
    }
    if (!target.hasClass('collapsed')) {
        return;
    }
    e.stopPropagation();
    e.preventDefault();
});

@ta-tikoma do you have a screen of the result?

default

Nice, you could make a pull request :)

Original problem fixed in https://github.com/the-control-group/voyager/pull/3620

3810 discusses another problem.

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wislem picture wislem  Â·  3Comments

TXRRNT picture TXRRNT  Â·  3Comments

vaggelis2018 picture vaggelis2018  Â·  3Comments

rayqiri picture rayqiri  Â·  3Comments

zzpwestlife picture zzpwestlife  Â·  3Comments