-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Link to default child is not highlighted when another child is active #2724
Link to default child is not highlighted when another child is active #2724
Comments
Despite the warning, you need to reference the parent route to get it highlighted. |
Referencing the parent route (and adding a redirect to the empty child) also results in no highlight when going to the child with a different parameter (https://jsfiddle.net/a5doLpvh/). |
if you used a named link, you are explicitly referencing the child, so it makes sense not to highlight the link if the child is not being displayed |
In https://jsfiddle.net/a5doLpvh/ I am explicitly referencing the parent which has a redirect to its child. I would expect that the link stays highlighted for the same child state but with a different parameter. |
I'm revisiting this. What happens is that the link points to a redirected url, so it's never active. Activating such behaviour needs a bit more thinking and is part of an RFC. If you have any input for that, it will be highly appreciated once the RFC is out :) This is a working version with no redirect: https://jsfiddle.net/o59bxs3m/ |
Same happening to me. Working correctly with ver 3.0.1. |
I'm marking this as a bug, the child should be indeed marked as active, whether there is a redirect or not. Playground for myself or anybody who wants to give this issue a shot: https://jsfiddle.net/posva/fj7ywzxv/ |
Fix active parent link when parent link redirects to a child and when the user navigates between child links fix vuejs#2724
Fix active parent link when parent link redirects to a child and when the user navigates between child links fix vuejs#2724
@posva Same for parent redirect, i guess: https://codesandbox.io/s/github/maxim-usikov/vue-router-issue-2724 |
@maxim-usikov the redirect should go on a child (see #2717). A route record with both FYI the fix hasn't been released yet |
@posva ahhh, thank you for explanation. |
Version
3.0.3
Reproduction link
https://jsfiddle.net/3svnktq2/1/
Steps to reproduce
The setup is that 'parent' is a menu item. When you go to that item, you are redirected to the child state with default parameters. Within that child state you can modify your parameters which should result in keeping the menu item highlighted.
-> Redirected to child state with type parameter 'type1' and parent is highlighted as active state
What is expected?
You stay in the same child state with a different parameter, keeping the parent link highlighted as the active state.
What is actually happening?
'Parent' is no longer highlighted as the active state. It is only highlighted when the type parameter is 'type1'.
This happens since version 3.0.3 of vue-router. If you change the loaded version of vue-router to 3.0.2, the behaviour is as expected. More history on this issue: #2717.
The text was updated successfully, but these errors were encountered: