Skip to content

Root menu with submenus wrong selected value #16

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
Reve opened this issue Jan 30, 2020 · 0 comments · May be fixed by #28
Open

Root menu with submenus wrong selected value #16

Reve opened this issue Jan 30, 2020 · 0 comments · May be fixed by #28

Comments

@Reve
Copy link

Reve commented Jan 30, 2020

The selected value of a root menu is overriden by _process_breadcrums. For example, if the _is_selected function correctly determines that a root menu is selected by accessing a link which contains the root's url, when _process_breadcrums is run, the selected value goes back to False.

As a workaround for this issue you can use:
{% if item.selected or item.url in request.path %} active {% endif %}

stfl added a commit to stfl/django-menu-generator that referenced this issue Oct 4, 2021
A
-> A.1
-> A.2

Selecting a menu item with a submenu (A) will always call _process_breadcrums() on all submenu items (A.1, A.2)
If non of the submenu items is selected, the parent node is also not selected.

Selecting A.1 will work and select A.
Directly selecting A will not mark A as selcted, as neither A.1 nor A.2 are selected.

fixes LaLogiaDePython#16
@stfl stfl linked a pull request Oct 4, 2021 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant