Differentiate between parent and exact pages in NavLink #9847
Replies: 4 comments
-
I did just realize, that you can do the visual part of this feature by using the I am still interested if you think it would be beneficial to mark parent pages with |
Beta Was this translation helpful? Give feedback.
-
It seems to me the underlying behavior is missing entirely in v6, regardless of whether it applies to |
Beta Was this translation helpful? Give feedback.
-
I'm going to convert this to a discussion so it can go through our new Open Development process. Please upvote the new Proposal if you'd like to see this considered! |
Beta Was this translation helpful? Give feedback.
-
Damn, just came across this ourselves. Will I guess need to add some custom handling here |
Beta Was this translation helpful? Give feedback.
-
What is the new or updated feature that you are suggesting?
Currently
NavLink
appliesaria-current="page"
to links that match the route, no matter if it is an exact match or not.It would be nice, to differentiate between a "parent" page and the current page.
There are several ways to solve this:
aria-current="page"
to the current page and usearia-current="true"
for parent pagesactive
to differentiate between the two pagesMaybe doing all of it also makes sense.
Why should this feature be included?
Sometimes the index route and a subroute are mutually exclusive. Imagine a layout that shows a table of data.
/food
: Display all food/food/sweet
: Show only sweet food/food/savoury
: Show only savoury foodIf you use
[aria-current="page"]
to style your current selection, and go to/food/sweet
, both/food
and/food/sweet
are marked as active.This example illustrates why a differentiaton would be nice:
[aria-current]
[aria-current="page"]
Beta Was this translation helpful? Give feedback.
All reactions