Skip to content

link active class not being applied to parent route #2785

@autumnwoodberry

Description

@autumnwoodberry

Version

3.0.2

Reproduction link

https://codepen.io/autumnwoodberry/pen/jovEqW?editors=1010

Steps to reproduce

Use vue-router version 3.0.6. Create a parent route with 2 child routes:

/parent
/parent/child-1
/parent/child-2

Add a redirect function to the parent route that will automatically redirect to child-1.
Create a router link for all 3 routes.
Observe that when the URL is /parent/child-1 the router link to /parent has the active route css class.
Observe that when the URL is /parent/child-2 the router link to /parent does NOT have the active route css class.

In version 3.0.2 the route active class will still be on the /parent router link when the URL is /parent/child-2.

Here is the working version example: https://codepen.io/autumnwoodberry/pen/jovEqW?editors=1010
And here is the non-working version example: https://codepen.io/autumnwoodberry/pen/yWxyYJ

What is expected?

Route active class should be present on a link to a parent route when the child route is active.

What is actually happening?

The route active class is not present.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions