nav: highlight active page with active class and aria-current

Add PageHelpers.ActivePage extension and apply it to top-level nav
items and the Account/Register + Account/Signin items in _LoginPartial,
so the current route gets the active class and aria-current="page"
for accessibility.
This commit is contained in:
Paul Schneider 2026-06-20 19:48:20 +01:00
commit 325cb339fd
3 changed files with 45 additions and 6 deletions

View file

@ -49,10 +49,10 @@
else
{
<li class="dropdown-item">
<a class="nav-link" asp-controller="Account" asp-action="Register" >Register</a>
<a class="nav-link @PageHelpers.ActivePage(ViewContext, "Account", "Register")" asp-controller="Account" asp-action="Register" >Register</a>
</li>
<li class="dropdown-item">
<a class="nav-link" asp-controller="Account" asp-action="Signin" asp-route-ReturnUrl="~/" asp-route-AllowRememberLogin="true" >Signin</a>
<a class="nav-link @PageHelpers.ActivePage(ViewContext, "Account", "Signin")" asp-controller="Account" asp-action="Signin" asp-route-ReturnUrl="~/" asp-route-AllowRememberLogin="true" >Signin</a>
</li>
}