Skip to content

Fix focus indicator contrast in templates - #69091

Open
Youssef1313 wants to merge 5 commits into
release/11.0from
dev/ygerges/blazor-contrast
Open

Fix focus indicator contrast in templates#69091
Youssef1313 wants to merge 5 commits into
release/11.0from
dev/ygerges/blazor-contrast

Conversation

@Youssef1313

@Youssef1313 Youssef1313 commented Sep 7, 2026

Copy link
Copy Markdown
Member

Fix focus indicator contrast in templates

This fixes the color contrast for focus indicator in Blazor, Mvc, and Razor Pages templates.

Description

This is an accessibility issue where the color contrast of the keyboard focus indicator is low.

Blazor template (before fix):

image image

Blazor template (after fix - tested with dotnet new blazor and dotnet new blazorwasm):

image image

Mvc and Razor Pages:

image

Linked issue (intentionally not closing per instructions in the issue) -> #68228

Customer Impact

New applications created from templates are more compliant to accessibility rules.

Regression?

No

Risk

Low

Fix is manually tested, and it's only an update to templates, not a real product change. So existing applications updating to newer version are not impacted. This is only when creating a new application from template which reduces the risks.

Verification

Manual

Packaging changes reviewed?

N/A

@github-actions github-actions Bot added the area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI label Sep 7, 2026
@Youssef1313 Youssef1313 changed the title Fix focus indicator contrast in Blazor template Fix focus indicator contrast in templates Sep 7, 2026
@Youssef1313
Youssef1313 changed the base branch from main to release/11.0 September 7, 2026 09:35
@Youssef1313
Youssef1313 force-pushed the dev/ygerges/blazor-contrast branch from 75a29f7 to 4d10056 Compare September 7, 2026 09:36
@Youssef1313 Youssef1313 added the Servicing-consider Shiproom approval is required for the issue label Sep 7, 2026
@Youssef1313
Youssef1313 marked this pull request as ready for review September 7, 2026 09:37
@Youssef1313
Youssef1313 requested a review from a team as a code owner September 7, 2026 09:37
Copilot AI lite review requested due to automatic review settings September 7, 2026 09:37
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hi @Youssef1313. Please make sure you've updated the PR description to use the Shiproom Template. Also, make sure this PR is not marked as a draft and is ready-to-merge.

To learn more about how to prepare a servicing PR click here.

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

The changes are narrowly scoped CSS overrides in templates that correctly target existing markup and improve focus visibility without introducing behavioral risk.

Pull request overview

Updates several ASP.NET Core project templates to improve keyboard focus indicator contrast for primary navigation links, addressing accessibility/visibility issues in default template styling.

Changes:

  • Add a high-contrast :focus-visible outline for navbar brand and nav links in MVC/Razor Pages “StarterWeb” templates.
  • Add a high-contrast :focus-visible outline for sidebar nav links in Blazor templates (WASM and Blazor Web App variants).
  • Remove conflicting focus box-shadow styling where the new outline is applied to ensure the intended indicator is consistently visible.
File summaries
File Description
src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-FSharp/wwwroot/css/site.css Adds high-contrast :focus-visible outline styling for navbar brand/nav links in the F# MVC template.
src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/wwwroot/css/site.css Adds high-contrast :focus-visible outline styling for navbar brand/nav links in the C# MVC template.
src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/wwwroot/css/site.css Adds high-contrast :focus-visible outline styling for navbar brand/nav links in the Razor Pages template.
src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Layout/NavMenu.razor.css Adds high-contrast :focus-visible outline styling for sidebar nav links in the Blazor WASM template.
src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Layout/NavMenu.razor.css Adds high-contrast :focus-visible outline styling for sidebar nav links in the Blazor Web App template.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@Youssef1313
Youssef1313 requested a review from artl93 September 7, 2026 11:10
@ilonatommy

Copy link
Copy Markdown
Member

@Youssef1313, what about net12? Do we have a PR that merges this to main?

@Youssef1313

Youssef1313 commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

@Youssef1313, what about net12? Do we have a PR that merges this to main?

We don't need to. This will automatically flow to main via automation. See #68594

@artl93 artl93 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved. Accessibility.

@artl93 artl93 added Servicing-approved Shiproom has approved the issue and removed Servicing-consider Shiproom approval is required for the issue labels Sep 8, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hi @Youssef1313. This PR was just approved to be included in the upcoming servicing release. Somebody from the @dotnet/aspnet-build team will get it merged when the branches are open. Until then, please make sure all the CI checks pass and the PR is reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI Servicing-approved Shiproom has approved the issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants