Opened 27 hours ago

Last modified 15 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, 27 hours ago

Keywords: accessibility added

comment:2 by Johannes Maron, 27 hours ago

Description: modified (diff)

comment:3 by Youngkwang Yang, 27 hours ago

Owner: set to Youngkwang Yang
Status: newassigned

comment:4 by Youngkwang Yang, 26 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, 26 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, 26 hours ago

Description: modified (diff)

comment:7 by Johannes Maron, 26 hours ago

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

comment:8 by Antoliny, 18 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.

From what I can tell, this issue seems to have existed even before the switch to fieldset, and may not be directly caused by that change.

5.0

No image "missing_label.png" attached to Ticket #36828

Is this the case you had in mind?

Version 0, edited 18 hours ago by Antoliny (next)

comment:9 by Antoliny, 18 hours ago

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