#36828: Missing input labels (WCAG2.1)
-------------------------------------+-------------------------------------
Reporter: Johannes Maron | Owner:
| Youngkwang Yang
Type: Bug | Status: assigned
Component: Forms | Version: 6.0
Severity: Release blocker | Resolution:
Keywords: accessibility, | Triage Stage: Accepted
label, wcag, fieldset |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):
* keywords: accessibility => accessibility, label, wcag, fieldset
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted
* version: dev => 6.0
Comment:
Accepting as a 6.0 regression on the basis that when `use_fieldset = True`
was used on `ClearableFileInput` in #35892, we didn't audit its template
for the presence of a `<label>`. `radio_option.html` had a label, but
`clearable_file_input.html` didn't.
> Since the original label was replaced by a legend, it seems that this
part (the “changed” input) should now have an associated label.
I agree -- thanks for the triage!!
> When using the ClearableFileInput widget and an initial value is
present, it appears that the input for changing the value does not have an
associated label.
I don't think it depends on the initial value, see:
{{{#!py
from django.db import models
from django import forms
class Upload(models.Model):
file = models.FileField(
verbose_name="CSV-File",
upload_to="csv",
help_text="File containing comma separated values.",
)
class Meta:
app_label = "myapp.Upload"
class UploadForm(forms.ModelForm):
class Meta:
model = Upload
fields = ["file"]
print(UploadForm().as_div())
}}}
5.2.9, with `<label>`:
{{{#!py
<div>
<label for="id_file">CSV-File:</label>
<div class="helptext" id="id_file_helptext">File containing comma
separated values.</div>
<input type="file" name="file" required aria-
describedby="id_file_helptext" id="id_file">
</div>
}}}
6.0, without:
{{{#!py
<div>
<fieldset aria-describedby="id_file_helptext">
<legend for="id_file">CSV-File:</legend>
<div class="helptext" id="id_file_helptext">File containing comma
separated values.</div>
<input type="file" name="file" required id="id_file"></fieldset>
</div>
}}}
We should target a fix for 6.0.1 on January 6.
--
Ticket URL: <
https://code.djangoproject.com/ticket/36828#comment:10>