Skip to content

Use h1 heading in Blazor NotFound.razor template page - #70305

Merged
ilonatommy merged 1 commit into
dotnet:mainfrom
dariatiurina:dariatiurina-notfound-page-heading-accessibility
Nov 4, 2026
Merged

ilonatommy merged 1 commit into
dotnet:mainfrom
dariatiurina:dariatiurina-notfound-page-heading-accessibility

Conversation

@dariatiurina

@dariatiurina dariatiurina commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Use h1 heading in Blazor NotFound.razor template page

Update Blazor NotFound.razor template and sample pages to use <h1> instead of <h3>.

Description

FocusOnNavigate in the Blazor Web App and Standalone Blazor WebAssembly project templates is configured with Selector="h1" in Routes.razor and App.razor, while NotFound.razor rendered <h3>Not Found</h3> without an <h1> element. As a result, navigating to /not-found had no matching h1 focus target for FocusOnNavigate to focus.

This change updates NotFound.razor in the Blazor project templates (BlazorWeb-CSharp and ComponentsWebAssembly-CSharp) and the corresponding template samples (BlazorWebAppPerPage, BlazorWebAppGlobal.Client, and BlazorWebAssemblyStandalone) to render <h1>Not Found</h1> so the page provides a matching h1 heading target for FocusOnNavigate.

Relates to dotnet/aspnetcore-scenario-tests#165

@github-actions github-actions Bot added area-blazor Includes: Blazor, Razor Components area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI labels Nov 4, 2026
@dariatiurina dariatiurina self-assigned this Nov 4, 2026
@dariatiurina
dariatiurina marked this pull request as ready for review November 4, 2026 13:05
@dariatiurina
dariatiurina requested a review from a team as a code owner November 4, 2026 13:05
@dariatiurina
dariatiurina requested review from ilonatommy and a balanced review from Copilot November 4, 2026 13:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the Not Found heading updates.

No open issues 🎉

What changed in this PR

Updates Blazor Not Found pages to provide an <h1> heading matching the existing FocusOnNavigate selector.

Changes:

  • Replaces <h3>Not Found</h3> with <h1>Not Found</h1> in both project templates.
  • Applies the same change to three corresponding samples, leaving routes, layouts, and message text unchanged.
File Description
src/​ProjectTemplates/​Web.ProjectTemplates/​content/​ComponentsWebAssembly-CSharp/​Pages/​NotFound.razor Adds the matching heading target in the standalone WebAssembly template.
src/​ProjectTemplates/​Web.ProjectTemplates/​content/​BlazorWeb-CSharp/​BlazorWebCSharp.1/​Components/​Pages/​NotFound.razor Adds the matching heading target in the Blazor Web App template.
src/​Components/​WebAssembly/​Samples/​BlazorWebAssemblyStandalone/​Pages/​NotFound.razor Aligns the standalone WebAssembly sample heading.
src/​Components/​Samples/​BlazorWebAppPerPage/​Components/​Pages/​NotFound.razor Aligns the per-page interactivity sample heading.
src/​Components/​Samples/​BlazorWebAppGlobal.Client/​Pages/​NotFound.razor Aligns the global interactivity client sample heading.

Review effort: Balanced

@ilonatommy
ilonatommy enabled auto-merge (squash) November 4, 2026 13:40
@ilonatommy
ilonatommy merged commit 48f4f99 into dotnet:main Nov 4, 2026
33 checks passed
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

⚠️ Documentation appears necessary, but a draft PR could not be created.

Confidence that documentation is needed: 80%

Drafted docs update to the NotFound.razor template snippets in the Blazor routing and navigation articles.

Documentation surfaces considered

  • Conceptual article: Required — Project template NotFound.razor changed h3 to h1; documented snippets in routing.md and navigation.md needed updating.
  • Migration guidance: Not required — No upgrade action is needed.
  • Breaking change: Not required — Heading element change in a template; no compatibility impact.

@dariatiurina

Copy link
Copy Markdown
Contributor Author

/backport to release/11.0

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0 (link to workflow run)

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — faf1e930 Deployed Nov 4, 2026 by ilonatommy via conclusion #188
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants