Skip to content

Fix LoginWith2fa remember-machine checkbox label association - #68844

Merged
wtgodbe merged 3 commits into
dotnet:release/11.0from
snemeckayova:snemeckayova/67669-blazor-identity-loginwith2fa-label
Sep 1, 2026
Merged

Fix LoginWith2fa remember-machine checkbox label association#68844
wtgodbe merged 3 commits into
dotnet:release/11.0from
snemeckayova:snemeckayova/67669-blazor-identity-loginwith2fa-label

Conversation

@snemeckayova

@snemeckayova snemeckayova commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes an accessibility issue in the Blazor Web App (Individual auth) template where the "Remember this machine" checkbox label used for="remember-machine" without a matching element id.

Changes

  • Removed the invalid for attribute so the checkbox uses implicit association via the wrapping <label>
  • Added a regression test in src/ProjectTemplates/test/Templates.Blazor.Tests/BlazorWebTemplateTest.cs checking whether:
    • "Input.RememberMachine" is present
    • "for=\"remember-machine\"" is not present

Fixes #67669

Customer Impact

Because the label declares a for that matches no element, the browser does not fall back to the implicit wrapping association, so the checkbox ends up with no associated label: screen readers announce an unlabeled checkbox and clicking the visible text does not toggle it.

Regression?

  • Yes
  • No

Introduced in #51134, which removed id="remember-machine" from the InputCheckbox but left for="remember-machine" on the label. The markup was correct when originally added in #50722.

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

@snemeckayova
snemeckayova requested review from Youssef1313 and javiercn and a lite review from Copilot August 27, 2026 11:05
@snemeckayova
snemeckayova requested a review from a team as a code owner August 27, 2026 11: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.

Pull request overview

This PR fixes an accessibility issue in the Blazor Web App (Individual auth) project template by ensuring the “Remember this machine” checkbox label is correctly associated with the checkbox (via implicit wrapping <label> association rather than an invalid for attribute).

Changes:

  • Removed the invalid for="remember-machine" attribute from the LoginWith2fa.razor label in the Blazor Web (C#) template.
  • Added a regression test that verifies the template no longer contains for="remember-machine" and still contains Input.RememberMachine.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/LoginWith2fa.razor Removes invalid for attribute to restore correct implicit label association for the checkbox.
src/ProjectTemplates/test/Templates.Blazor.Tests/BlazorWebTemplateTest.cs Adds regression coverage ensuring the template output does not contain the invalid for="remember-machine" string.

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

Comment thread src/ProjectTemplates/test/Templates.Blazor.Tests/BlazorWebTemplateTest.cs Outdated
Comment thread src/ProjectTemplates/test/Templates.Blazor.Tests/BlazorWebTemplateTest.cs Outdated
@snemeckayova
snemeckayova force-pushed the snemeckayova/67669-blazor-identity-loginwith2fa-label branch from 791af9f to b98aa92 Compare August 27, 2026 14:31
@snemeckayova
snemeckayova requested review from a team, BrennanConroy and wtgodbe as code owners August 27, 2026 14:31
@snemeckayova
snemeckayova changed the base branch from main to release/11.0 August 27, 2026 14:32
@snemeckayova snemeckayova added the Servicing-approved Shiproom has approved the issue label Aug 31, 2026
@snemeckayova
snemeckayova force-pushed the snemeckayova/67669-blazor-identity-loginwith2fa-label branch from 3421fab to e0ea890 Compare August 31, 2026 08:42
@snemeckayova snemeckayova added Servicing-consider Shiproom approval is required for the issue and removed Servicing-approved Shiproom has approved the issue labels Aug 31, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hi @snemeckayova. 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.

@snemeckayova
snemeckayova requested a review from artl93 August 31, 2026 13:32

@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.

Accessibility. Approved.

@snemeckayova / @javiercn - Since this is not flagged as a regression, how long has the issue been in the code? How did we find this? Do we need to make a wider accessibility pass?

@artl93 artl93 added Servicing-approved Shiproom has approved the issue and removed Servicing-consider Shiproom approval is required for the issue labels Aug 31, 2026
@snemeckayova

snemeckayova commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@artl93 I apologize, I had this marked incorrectly, it is a regression. #51134 removed id="remember-machine" from the InputCheckbox but left for="remember-machine" on the label. Updated the description accordingly.

As for the other two questions, I'm not sure honestly. Hopefully @javiercn can give more insight.

@Youssef1313

Copy link
Copy Markdown
Member

@artl93 The regression here was introduced in .NET 8 given the PR that Soňa linked, so that has been for 2 years.

I believe @javiercn was doing some a11y pass to find this. It's not customer reported so far.

@wtgodbe
wtgodbe merged commit 6c010a6 into dotnet:release/11.0 Sep 1, 2026
42 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc2 milestone Sep 2, 2026
wtgodbe added a commit that referenced this pull request Sep 2, 2026
* Fix validation summary list semantics (#68913)

* Fix LoginWith2fa remember-machine checkbox label association (#68844)

* Remove LoginWith2fa remember-machine checkbox label association

* Formatting fix

* Remove test

* Fix installer background for bundles (#68931)

---------

Co-authored-by: Soňa Nemečkayová <109719150+snemeckayova@users.noreply.github.com>
Co-authored-by: William Godbe <wigodbe@microsoft.com>
Co-authored-by: Youssef Fahmy <youssefvictor00@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Servicing-approved Shiproom has approved the issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blazor Identity LoginWith2fa "Remember this machine" checkbox label has a for that matches no element

6 participants