Opened 31 hours ago

Last modified 19 hours ago

#36828 assigned Bug

Missing input labels (WCAG2.1)

Reported by: Johannes Maron Owned by: Youngkwang Yang
Component: Forms Version: dev
Severity: Normal Keywords: accessibility
Cc: Johannes Maron, Antoliny Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Johannes Maron)

Howdy,

I noticed Django sometimes replaces the label with a fieldset tag. However, input labels are required as of WCAG 2.1; see also: https://www.w3.org/TR/WCAG21/#labels-or-instructions

Since Django must be WCAG2.2 AAA compliant, we might even want to patch all supported versions. However, this would mean shipping a rendering change in a bugfix.

My current impulse would be to enforce labels for WCAG compliance in 6.1, since shipping a rendering change within a bug fix release might result into more issues for users.

Cheers!
Joe

Change History (9)

comment:1 by Johannes Maron, 30 hours ago

Keywords: accessibility added

comment:2 by Johannes Maron, 30 hours ago

Description: modified (diff)

comment:3 by Youngkwang Yang, 30 hours ago

Owner: set to Youngkwang Yang
Status: newassigned

comment:4 by Youngkwang Yang, 30 hours ago

This looks similar to #36724 (fixed in PR https://github.com/django/django/pull/20080).
could you check which version you're testing with?

comment:5 by Johannes Maron, 29 hours ago

Thanks! Yes, that does resolve half of the issue. We have correct HTML, but the WCAG violation remains.

comment:6 by Johannes Maron, 29 hours ago

Description: modified (diff)

comment:7 by Johannes Maron, 29 hours ago

Summary: Django form fields render into invalid HTMLMissing input labels (WCAG2.1)

comment:8 by Antoliny, 22 hours ago

Thank you, Joe :)

Could you share an example of where the issue shows up?

My guess is that you’re referring to ClearableFileInput, which was recently switched to use a fieldset. 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.

Since the original label was replaced by a legend, it seems that this part (the “changed” input) should now have an associated label.

Is this the case you had in mind?

Last edited 19 hours ago by Antoliny (previous) (diff)

comment:9 by Antoliny, 21 hours ago

Cc: Antoliny added
Note: See TracTickets for help on using tickets.
Back to Top