We have a section of code like this in a Razor page (.cshtml) file:
<div class="form-group">
<label asp-for="Input.UserName" class="control-label">User</label>
<input asp-for="Input.UserName" class="form-control" placeholder="User" autofocus>
</div>
It triggers a warning that issue that a label within a form should be associated with a control. However, in the generated html, the html ‘for’ attribute appears to be generated correctly.
<div class="form-group">
<label class="control-label" for="Input_UserName">User</label>
<input class="form-control" placeholder="User" autofocus="" type="text" data-val="true" data-val-required="The UserName field is required." id="Input_UserName" name="Input.UserName" value="">
</div>
It seems like it’s not aware of the asp-for label tag helper. Is this a false positive? Is it expected based on where support for Razor pages is at right now? Or do I most likely just have something misconfigured?