anvil-works / routing

routing - Built with Anvil
https://routing-docs.anvil.works
MIT License
2 stars 1 forks source link

Multiple navlinks highlighted #38

Closed jshaffstall closed 1 week ago

jshaffstall commented 1 week ago

Describe the bug

When multiple nav links on the left sidebar share the same prefix path (e.g. /account and /account/billing), both will be highlighted when going to the longer path. So when going to /account/billing, both nav links are highlighted as being the current page.

Version 0.3.2

To Reproduce In the following clone: https://anvil.works/build#clone:DTCVV32XON5IEF24=TAI5S6GFWVB64I75SCXVQKZW

On the first page, click the Account link in the left sidebar. That will take you to /account/billing and both the Account and Billing links will be highlighted.

Expected behavior I'd expect only the more specific link to be highlighted as the current page.

s-cork commented 1 week ago

In active group in the designer set exact_path to true. By default we use prefix matching to determine whether a link is active.

jshaffstall commented 1 week ago

Ah, sorry, I totally missed that section of properties.

s-cork commented 1 week ago

Yeah - double checked and it's also documented here: https://routing-docs.anvil.works/navigating/navigation-components/#active-state