Skip to content

Commit d3e244c

Browse files
[Blazor] Fix Identity UI accessibility issues (#57033)
1 parent 27f2a01 commit d3e244c

19 files changed

+52
-52
lines changed

src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Account/Pages/ExternalLogin.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
<DataAnnotationsValidator />
3636
<ValidationSummary class="text-danger" role="alert" />
3737
<div class="form-floating mb-3">
38-
<InputText @bind-Value="Input.Email" class="form-control" autocomplete="email" placeholder="Please enter your email." />
39-
<label for="email" class="form-label">Email</label>
38+
<InputText @bind-Value="Input.Email" id="Input.Email" class="form-control" autocomplete="email" placeholder="Please enter your email." />
39+
<label for="Input.Email" class="form-label">Email</label>
4040
<ValidationMessage For="() => Input.Email" />
4141
</div>
4242
<button type="submit" class="w-100 btn btn-lg btn-primary">Register</button>

src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Account/Pages/ForgotPassword.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
<ValidationSummary class="text-danger" role="alert" />
2525

2626
<div class="form-floating mb-3">
27-
<InputText @bind-Value="Input.Email" class="form-control" autocomplete="username" aria-required="true" placeholder="name@example.com" />
28-
<label for="email" class="form-label">Email</label>
27+
<InputText @bind-Value="Input.Email" id="Input.Email" class="form-control" autocomplete="username" aria-required="true" placeholder="name@example.com" />
28+
<label for="Input.Email" class="form-label">Email</label>
2929
<ValidationMessage For="() => Input.Email" class="text-danger" />
3030
</div>
3131
<button type="submit" class="w-100 btn btn-lg btn-primary">Reset password</button>

src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Account/Pages/ForgotPasswordConfirmation.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<PageTitle>Forgot password confirmation</PageTitle>
44

55
<h1>Forgot password confirmation</h1>
6-
<p>
6+
<p role="alert">
77
Please check your email to reset your password.
88
</p>

src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Account/Pages/InvalidPasswordReset.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<PageTitle>Invalid password reset</PageTitle>
44

55
<h1>Invalid password reset</h1>
6-
<p>
6+
<p role="alert">
77
The password reset link is invalid.
88
</p>

src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Account/Pages/Lockout.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
<header>
66
<h1 class="text-danger">Locked out</h1>
7-
<p class="text-danger">This account has been locked out, please try again later.</p>
7+
<p class="text-danger" role="alert">This account has been locked out, please try again later.</p>
88
</header>

src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Account/Pages/Login.razor

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
<hr />
2424
<ValidationSummary class="text-danger" role="alert" />
2525
<div class="form-floating mb-3">
26-
<InputText @bind-Value="Input.Email" class="form-control" autocomplete="username" aria-required="true" placeholder="name@example.com" />
27-
<label for="email" class="form-label">Email</label>
26+
<InputText @bind-Value="Input.Email" id="Input.Email" class="form-control" autocomplete="username" aria-required="true" placeholder="name@example.com" />
27+
<label for="Input.Email" class="form-label">Email</label>
2828
<ValidationMessage For="() => Input.Email" class="text-danger" />
2929
</div>
3030
<div class="form-floating mb-3">
31-
<InputText type="password" @bind-Value="Input.Password" class="form-control" autocomplete="current-password" aria-required="true" placeholder="password" />
32-
<label for="password" class="form-label">Password</label>
31+
<InputText type="password" @bind-Value="Input.Password" id="Input.Password" class="form-control" autocomplete="current-password" aria-required="true" placeholder="password" />
32+
<label for="Input.Password" class="form-label">Password</label>
3333
<ValidationMessage For="() => Input.Password" class="text-danger" />
3434
</div>
3535
<div class="checkbox mb-3">

src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Account/Pages/LoginWith2fa.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
<DataAnnotationsValidator />
2424
<ValidationSummary class="text-danger" role="alert" />
2525
<div class="form-floating mb-3">
26-
<InputText @bind-Value="Input.TwoFactorCode" class="form-control" autocomplete="off" />
27-
<label for="two-factor-code" class="form-label">Authenticator code</label>
26+
<InputText @bind-Value="Input.TwoFactorCode" id="Input.TwoFactorCode" class="form-control" autocomplete="off" />
27+
<label for="Input.TwoFactorCode" class="form-label">Authenticator code</label>
2828
<ValidationMessage For="() => Input.TwoFactorCode" class="text-danger" />
2929
</div>
3030
<div class="checkbox mb-3">

src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Account/Pages/LoginWithRecoveryCode.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
<DataAnnotationsValidator />
2525
<ValidationSummary class="text-danger" role="alert" />
2626
<div class="form-floating mb-3">
27-
<InputText @bind-Value="Input.RecoveryCode" class="form-control" autocomplete="off" placeholder="RecoveryCode" />
28-
<label for="recovery-code" class="form-label">Recovery Code</label>
27+
<InputText @bind-Value="Input.RecoveryCode" id="Input.RecoveryCode" class="form-control" autocomplete="off" placeholder="RecoveryCode" />
28+
<label for="Input.RecoveryCode" class="form-label">Recovery Code</label>
2929
<ValidationMessage For="() => Input.RecoveryCode" class="text-danger" />
3030
</div>
3131
<button type="submit" class="w-100 btn btn-lg btn-primary">Log in</button>

src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Account/Pages/Manage/ChangePassword.razor

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@
2020
<DataAnnotationsValidator />
2121
<ValidationSummary class="text-danger" role="alert" />
2222
<div class="form-floating mb-3">
23-
<InputText type="password" @bind-Value="Input.OldPassword" class="form-control" autocomplete="current-password" aria-required="true" placeholder="Please enter your old password." />
24-
<label for="old-password" class="form-label">Old password</label>
23+
<InputText type="password" @bind-Value="Input.OldPassword" id="Input.OldPassword" class="form-control" autocomplete="current-password" aria-required="true" placeholder="Please enter your old password." />
24+
<label for="Input.OldPassword" class="form-label">Old password</label>
2525
<ValidationMessage For="() => Input.OldPassword" class="text-danger" />
2626
</div>
2727
<div class="form-floating mb-3">
28-
<InputText type="password" @bind-Value="Input.NewPassword" class="form-control" autocomplete="new-password" aria-required="true" placeholder="Please enter your new password." />
29-
<label for="new-password" class="form-label">New password</label>
28+
<InputText type="password" @bind-Value="Input.NewPassword" id="Input.NewPassword" class="form-control" autocomplete="new-password" aria-required="true" placeholder="Please enter your new password." />
29+
<label for="Input.NewPassword" class="form-label">New password</label>
3030
<ValidationMessage For="() => Input.NewPassword" class="text-danger" />
3131
</div>
3232
<div class="form-floating mb-3">
33-
<InputText type="password" @bind-Value="Input.ConfirmPassword" class="form-control" autocomplete="new-password" aria-required="true" placeholder="Please confirm your new password." />
34-
<label for="confirm-password" class="form-label">Confirm password</label>
33+
<InputText type="password" @bind-Value="Input.ConfirmPassword" id="Input.ConfirmPassword" class="form-control" autocomplete="new-password" aria-required="true" placeholder="Please confirm your new password." />
34+
<label for="Input.ConfirmPassword" class="form-label">Confirm password</label>
3535
<ValidationMessage For="() => Input.ConfirmPassword" class="text-danger" />
3636
</div>
3737
<button type="submit" class="w-100 btn btn-lg btn-primary">Update password</button>

src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Account/Pages/Manage/DeletePersonalData.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
@if (requirePassword)
3030
{
3131
<div class="form-floating mb-3">
32-
<InputText type="password" @bind-Value="Input.Password" class="form-control" autocomplete="current-password" aria-required="true" placeholder="Please enter your password." />
33-
<label for="password" class="form-label">Password</label>
32+
<InputText type="password" @bind-Value="Input.Password" id="Input.Password" class="form-control" autocomplete="current-password" aria-required="true" placeholder="Please enter your password." />
33+
<label for="Input.Password" class="form-label">Password</label>
3434
<ValidationMessage For="() => Input.Password" class="text-danger" />
3535
</div>
3636
}

0 commit comments

Comments
 (0)