diff options
| author | Gregor Jerše <gregor.jerse@genialis.com> | 2023-06-02 16:27:24 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-08-01 06:08:04 +0200 |
| commit | 10725a31879c55ba8d92aaa3275093d136957bef (patch) | |
| tree | b2894e3fbf2c3daa3da22d1c6dec3d48dc94963b /django/forms | |
| parent | fff14736f1cc594f79ea0e2656b8375d837b7aca (diff) | |
Fixed #32820 -- Added aria-invalid="true" to fields with errors.
Co-authored-by: Demetris Stavrou <demestav@gmail.com>
Co-authored-by: David Smith <smithdc@gmail.com>
Diffstat (limited to 'django/forms')
| -rw-r--r-- | django/forms/boundfield.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py index 0b4439efde..98ac5b8208 100644 --- a/django/forms/boundfield.py +++ b/django/forms/boundfield.py @@ -287,6 +287,8 @@ class BoundField(RenderableFieldMixin): attrs["required"] = True if self.field.disabled: attrs["disabled"] = True + if not widget.is_hidden and self.errors: + attrs["aria-invalid"] = "true" # If a custom aria-describedby attribute is given (either via the attrs # argument or widget.attrs) and help_text is used, the custom # aria-described by is preserved so user can set the desired order. |
