Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Some Missing Accessible Names for Input Elements #33714

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Consider the following example:
<DataAnnotationsValidator />
<ValidationSummary />

<p>Name: <InputText @bind-Value="Item.Name" /></p>
<p><label>Name: <InputText @bind-Value="Item.Name" /></label></p>

<button type="submit">Submit</button>
</EditForm>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<form asp-action="Index" method="get">
<div class="form-actions no-color">
<p>
Find by name: <input type="text" name="SearchString" value="@ViewData["CurrentFilter"]" />
<label>Find by name: <input type="text" name="SearchString" value="@ViewData["CurrentFilter"]" /></label>
<input type="submit" value="Search" class="btn btn-default" /> |
<a asp-action="Index">Back to Full List</a>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<form asp-action="Index" method="get">
<div class="form-actions no-color">
<p>
Find by name: <input type="text" name="SearchString" value="@ViewData["CurrentFilter"]" />
<label>Find by name: <input type="text" name="SearchString" value="@ViewData["CurrentFilter"]" /></label>
<input type="submit" value="Search" class="btn btn-default" /> |
<a asp-action="Index">Back to Full List</a>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<form asp-action="Index" method="get">
<div class="form-actions no-color">
<p>
Find by name: <input type="text" name="SearchString" value="@ViewData["CurrentFilter"]" />
<label>Find by name: <input type="text" name="SearchString" value="@ViewData["CurrentFilter"]" /></label>
<input type="submit" value="Search" class="btn btn-default" /> |
<a asp-action="Index">Back to Full List</a>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<form asp-page="./Index" method="get">
<div class="form-actions no-color">
<p>
Find by name: <input type="text" name="SearchString" value="@Model.CurrentFilter" />
<label>Find by name: <input type="text" name="SearchString" value="@Model.CurrentFilter" /></label>
<input type="submit" value="Search" class="btn btn-default" /> |
<a asp-page="./Index">Back to full List</a>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<form sp-page="./Index" method="get">
<div class="form-actions no-color">
<p>
Find by name: <input type="text" name="SearchString" value="@Model.CurrentFilter" />
<label>Find by name: <input type="text" name="SearchString" value="@Model.CurrentFilter" /></label>
<input type="submit" value="Search" class="btn btn-default" /> |
<a asp-page="./Index">Back to full List</a>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<form sp-page="./Index" method="get">
<div class="form-actions no-color">
<p>
Find by name: <input type="text" name="SearchString" value="@ViewData["currentFilter"]" />
<label>Find by name: <input type="text" name="SearchString" value="@ViewData["currentFilter"]" /></label>
<input type="submit" value="Search" class="btn btn-default" /> |
<a asp-page="./Index">Back to full List</a>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<form sp-page="./Index" method="get">
<div class="form-actions no-color">
<p>
Find by name: <input type="text" name="SearchString" value="@ViewData["currentFilter"]" />
<label>Find by name: <input type="text" name="SearchString" value="@ViewData["currentFilter"]" /></label>
<input type="submit" value="Search" class="btn btn-default" /> |
<a asp-page="./Index">Back to full List</a>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<form sp-page="./Index" method="get">
<div class="form-actions no-color">
<p>
Find by name: <input type="text" name="SearchString" value="@ViewData["currentFilter"]" />
<label>Find by name: <input type="text" name="SearchString" value="@ViewData["currentFilter"]" /></label>
<input type="submit" value="Search" class="btn btn-default" /> |
<a asp-page="./Index">Back to full List</a>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<form sp-page="./Index" method="get">
<div class="form-actions no-color">
<p>
Find by name: <input type="text" name="SearchString" value="@ViewData["currentFilter"]" />
<label>Find by name: <input type="text" name="SearchString" value="@ViewData["currentFilter"]" /></label>
<input type="submit" value="Search" class="btn btn-default" /> |
<a asp-page="./Index">Back to full List</a>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<form sp-page="./Index" method="get">
<div class="form-actions no-color">
<p>
Find by name: <input type="text" name="SearchString" value="@ViewData["currentFilter"]" />
<label>Find by name: <input type="text" name="SearchString" value="@ViewData["currentFilter"]" /></label>
<input type="submit" value="Search" class="btn btn-default" /> |
<a asp-page="./Index">Back to full List</a>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<form asp-page="./Index" method="get">
<div class="form-actions no-color">
<p>
Find by name: <input type="text" name="SearchString" value="@Model.CurrentFilter" />
<label>Find by name: <input type="text" name="SearchString" value="@Model.CurrentFilter" /></label>
<input type="submit" value="Search" class="btn btn-default" /> |
<a asp-page="./Index">Back to full List</a>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<form asp-page="./Index" method="get">
<div class="form-actions no-color">
<p>
Find by name: <input type="text" name="SearchString" value="@Model.CurrentFilter" />
<label>Find by name: <input type="text" name="SearchString" value="@Model.CurrentFilter" /></label>
<input type="submit" value="Search" class="btn btn-default" /> |
<a asp-page="./Index">Back to full List</a>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<form asp-page="./Index" method="get">
<div class="form-actions no-color">
<p>
Find by name: <input type="text" name="SearchString" value="@Model.CurrentFilter" />
<label>Find by name: <input type="text" name="SearchString" value="@Model.CurrentFilter" /></label>
<input type="submit" value="Search" class="btn btn-default" /> |
<a asp-page="./Index">Back to full List</a>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<form asp-page="./Index" method="get">
<div class="form-actions no-color">
<p>
Find by name: <input type="text" name="SearchString" value="@Model.CurrentFilter" />
<label>Find by name: <input type="text" name="SearchString" value="@Model.CurrentFilter" /></label>
<input type="submit" value="Search" class="btn btn-default" /> |
<a asp-page="./Index">Back to full List</a>
</p>
Expand Down
4 changes: 2 additions & 2 deletions aspnetcore/mvc/models/model-binding.md
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,9 @@ public class PersonController
```cshtml
@model Person

Name: <input asp-for="Name" />
<label>Name: <input asp-for="Name" /></label>
<br />
Age: <input asp-for="Age" />
<label>Age: <input asp-for="Age" /></label>
```

When validating record types, the runtime searches for binding and validation metadata specifically on parameters rather than on properties.
Expand Down
12 changes: 6 additions & 6 deletions aspnetcore/mvc/models/model-binding/includes/model-binding7.md
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,9 @@ public class PersonController
```cshtml
@model Person

Name: <input asp-for="Name" />
<label>Name: <input asp-for="Name" /></label>
<br />
Age: <input asp-for="Age" />
<label>Age: <input asp-for="Age" /></label>
```

When validating record types, the runtime searches for binding and validation metadata specifically on parameters rather than on properties.
Expand Down Expand Up @@ -1117,9 +1117,9 @@ public class PersonController
```cshtml
@model Person

Name: <input asp-for="Name" />
<label>Name: <input asp-for="Name" /></label>
<br />
Age: <input asp-for="Age" />
<label>Age: <input asp-for="Age" /></label>
```

When validating record types, the runtime searches for binding and validation metadata specifically on parameters rather than on properties.
Expand Down Expand Up @@ -1764,9 +1764,9 @@ public class PersonController
```cshtml
@model Person

Name: <input asp-for="Name" />
<label>Name: <input asp-for="Name" /></label>
...
Age: <input asp-for="Age" />
<label>Age: <input asp-for="Age" /></label>
```

When validating record types, the runtime searches for binding and validation metadata specifically on parameters rather than on properties.
Expand Down
2 changes: 1 addition & 1 deletion aspnetcore/mvc/views/razor.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ In C#, a `using` statement is used to ensure an object is disposed. In Razor, th
@using (Html.BeginForm())
{
<div>
Email: <input type="email" id="Email" value="">
<label>Email: <input type="email" id="Email" value=""></label>
<button>Register</button>
</div>
}
Expand Down
8 changes: 4 additions & 4 deletions aspnetcore/mvc/views/working-with-forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -505,14 +505,14 @@ The generated HTML (when the model is valid):

```html
<form action="/DemoReg/Register" method="post">
Email: <input name="Email" id="Email" type="email" value=""
<label>Email: <input name="Email" id="Email" type="email" value=""
data-val-required="The Email field is required."
data-val-email="The Email field is not a valid email address."
data-val="true"><br>
data-val="true"></label><br>
<span class="field-validation-valid" data-valmsg-replace="true"
data-valmsg-for="Email"></span><br>
Password: <input name="Password" id="Password" type="password"
data-val-required="The Password field is required." data-val="true"><br>
<label>Password: <input name="Password" id="Password" type="password"
data-val-required="The Password field is required." data-val="true"></label><br>
<span class="field-validation-valid" data-valmsg-replace="true"
data-valmsg-for="Password"></span><br>
<button type="submit">Register</button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@model RegisterAddressViewModel

<form asp-controller="Demo" asp-action="RegisterAddress" method="post">
Email: <input asp-for="Email" /> <br />
Password: <input asp-for="Password" /><br />
Address: <input asp-for="Address.AddressLine1" /><br />
<label>Email: <input asp-for="Email" /></label> <br />
<label>Password: <input asp-for="Password" /></label><br />
<label>Address: <input asp-for="Address.AddressLine1" /></label><br />
<button type="submit">Register</button>
</form>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@model RegisterViewModel

<form asp-controller="Demo" asp-action="RegisterInput" method="post">
Email: <input asp-for="Email" /> <br />
Password: <input asp-for="Password" /><br />
<label>Email: <input asp-for="Email" /></label> <br />
<label>Password: <input asp-for="Password" /></label><br />
<button type="submit">Register</button>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<form asp-controller="Demo" asp-action="RegisterValidation" method="post">
<div asp-validation-summary="ModelOnly"></div>
Email: <input asp-for="Email" /> <br />
<label>Email: <input asp-for="Email" /></label> <br />
<span asp-validation-for="Email"></span><br />
Password: <input asp-for="Password" /><br />
<label>Password: <input asp-for="Password" /></label><br />
<span asp-validation-for="Password"></span><br />
<button type="submit">Register</button>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</p>
<div asp-validation-summary="All"></div>
<form method="POST">
<div>Name: <input asp-for="Customer.Name" /></div>
<div><label>Name: <input asp-for="Customer.Name" /></label></div>
<input type="submit" />
</form>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</p>
<div asp-validation-summary="All"></div>
<form method="POST">
<div>Name: <input asp-for="Customer.Name" /></div>
<div><label>Name: <input asp-for="Customer.Name" /></label></div>
<input type="submit" />
</form>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</p>
<div asp-validation-summary="All"></div>
<form method="POST">
<div>Name: <input asp-for="Customer.Name" /></div>
<div><label>Name: <input asp-for="Customer.Name" /></label></div>
<input type="submit" />
</form>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</p>
<div asp-validation-summary="All"></div>
<form method="POST">
<div>Name: <input asp-for="Customer.Name" /></div>
<div><label>Name: <input asp-for="Customer.Name" /></label></div>
<input type="submit" />
</form>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</p>
<div asp-validation-summary="All"></div>
<form method="POST">
<div>Name: <input asp-for="Customer.Name" /></div>
<div><label>Name: <input asp-for="Customer.Name" /></label></div>
<input type="submit" />
</form>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</p>
<div asp-validation-summary="All"></div>
<form method="POST">
<div>Name: <input asp-for="Customer.Name" /></div>
<div><label>Name: <input asp-for="Customer.Name" /></label></div>
<!-- <snippet_Handlers> -->
<input type="submit" asp-page-handler="JoinList" value="Join" />
<input type="submit" asp-page-handler="JoinListUC" value="JOIN UC" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</p>
<div asp-validation-summary="All"></div>
<form method="POST">
<div>Name: <input asp-for="Customer.Name" /></div>
<div><label>Name: <input asp-for="Customer.Name" /></label></div>
<input type="submit" asp-page-handler="JoinList" value="Join" />
<input type="submit" asp-page-handler="JoinListUC" value="JOIN UC" />
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</p>
<div asp-validation-summary="All"></div>
<form method="POST">
<div>Name: <input asp-for="Customer.Name" /></div>
<div><label>Name: <input asp-for="Customer.Name" /></label></div>
<input type="submit" />
</form>
</body>
Expand Down
4 changes: 2 additions & 2 deletions aspnetcore/release-notes/aspnetcore-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ The `Person/Index.cshtml` file:
```cshtml
@model Person

Name: <input asp-for="Model.Name" />
<label>Name: <input asp-for="Model.Name" /></label>
<span asp-validation-for="Model.Name" />

Age: <input asp-for="Model.Age" />
<label>Age: <input asp-for="Model.Age" /></label>
<span asp-validation-for="Model.Age" />
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<h2>Form 1</h2>
<form asp-action="SamplePost" method="post">
<div>
Message: <input type="text" name="message" />
<label>Message: <input type="text" name="message" /></label>
<input type="submit" value="Send" />
</div>
</form>
Expand All @@ -21,7 +21,7 @@
@using (Html.BeginForm("SamplePost", "Home"))
{
<div>
Message: <input type="text" name="message" />
<label>Message: <input type="text" name="message" /></label>
<input type="submit" value="Send" />
</div>
}
Expand All @@ -31,7 +31,7 @@
<form action="/home/samplepost" method="post">
@Html.AntiForgeryToken()
<div>
Message: <input type="text" name="message" />
<label>Message: <input type="text" name="message" /></label>
<input type="submit" value="Send" />
</div>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<option value="">All</option>
</select>

Title: <input type="text" name="SearchString">
<label>Title: <input type="text" name="SearchString"></label>
<input type="submit" value="Filter" />
</p>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<option value="">All</option>
</select>

Title: <input asp-for="SearchString">
<label>Title: <input asp-for="SearchString"></label>
<input type="submit" value="Filter" />
</p>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<option value="">All</option>
</select>

Title: <input type="text" asp-for="SearchString" />
<label>Title: <input type="text" asp-for="SearchString" /></label>
<input type="submit" value="Filter" />
</p>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<option value="">All</option>
</select>

Title: <input type="text" asp-for="SearchString" />
<label>Title: <input type="text" asp-for="SearchString" /></label>
<input type="submit" value="Filter" />
</p>
</form>
Expand Down
Loading
Loading