id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 32820 Django forms - fields’ errors should be programmatically associated with fields Thibaud Colas "Related: [https://code.djangoproject.com/ticket/32819 #32819]. This could be worth fixing at the same time, although I would expect this issue shouldn’t require as breaking of a change to fix. Django currently displays errors above fields in its forms rendering: {{{

Help

}}} One thing this is missing is a way to programmatically indicate the field is in error – currently this can only be inferred visually because the error messages are displayed above the field. This is fail of WCAG 2.1 level A [https://www.w3.org/WAI/WCAG21/Understanding/error-identification 3.3.1: Error Identification]. The most common way to do this programmatically is to use `aria-invalid=""true""` on the field, as demonstrated in the non-normative [https://www.w3.org/WAI/WCAG21/Techniques/aria/ARIA21 technique ARIA21]: {{{ }}} Here is the result in VoiceOver on Safari – announcing ""invalid data"" after the field label and required state: [[Image(https://code.djangoproject.com/raw-attachment/ticket/32820/email-required-aria-invalid.png)]] " Bug new Forms 3.2 Normal accessibility, ui, forms Unreviewed 0 0 0 0 0 0