Strange behavior with NavLink and index #8662
Unanswered
stephanedupont
asked this question in
Q&A
Replies: 1 comment
-
I believe that in
... so that it looks like this:
Shall I make a PR? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm encountering a strange behavior, but maybe there's something I'm not seeing or doing wrong, so I thought that it would be better to create a discussion first instead of an issue.
I have a main menu with a link to a settings route:
This page has a secondary menu with 3 settings sections, let's say "Common", "A" and "B", corresponding to these routes:
/settings
/settings/A
/settings/B
This secondary menu is like this:
... and the routes are defined like this:
Now, the problem:
If I go to "/settings", the
CommonSettingsRoute
content is displayed, the main menu navlink has anactive
class added, but the secondary menu doesn'tIf I go to "/settings/", then everything works fine, the
CommonSettingsRoute
content is displayed, the main menu navlink has anactive
class added, and the secondary menu also does (as expected)If I go to "/settings/A", then it also works as expected, both menu items are active ("settings" in the main menu, and "A" in the secondary menu).
To try to fix this (fix the fact that in /settings the main menu is not active), I changed the main menu link to this:
By doing this, I have the following result:
If I go to "/settings", the
CommonSettingsRoute
content is displayed, but none of the menu are active.If I go to "/settings/", then everything works fine, the
CommonSettingsRoute
content is displayed, the main menu navlink has anactive
class added, and the secondary menu also does (as expected)If I go to "/settings/A", then the main menu item is no longer active
Is there something that I'm doing wrong here? Or is it a bug?
Beta Was this translation helpful? Give feedback.
All reactions