1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

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>
This commit is contained in:
Gregor Jerše
2023-06-02 16:27:24 +02:00
committed by Mariusz Felisiak
parent fff14736f1
commit 10725a3187
7 changed files with 156 additions and 95 deletions

View File

@@ -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.