How does focus management on navigation work with the FocusOnNavigate component?
Last updated
FocusOnNavigatemoves keyboard focus to a chosen element after each routing navigation, placed inside theRouter(usually in App.razor).Its
Selectorparameter is a CSS selector (commonlyh1) and the first match gets focused (headings gettabindex="-1"automatically).It matters for accessibility: SPAs don't reload pages, so browsers never reset focus for screen reader and keyboard users.
- https://medium.com/@bhargavkoya56/net-10-c-14-deep-dive-for-modern-development-part1-concepts-and-code-snippets-0b875ed38a60
- https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/routing?view=aspnetcore-10.0
- https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/fundamentals/routing.md?plain=1
- https://www.telerik.com/blogs/blazor-basics-blazor-routing-navigation-fundamentals