From 387475c5b2f1aa32103dbe21cb281d3b35165a0c Mon Sep 17 00:00:00 2001 From: sanjeevholla26 Date: Fri, 30 Aug 2024 23:44:32 +0530 Subject: [PATCH] Refs #35706 -- Prefixed 'Error:' to titles of admin pages with form errors. This improves the screen reader experience. --- .../admin/auth/user/change_password.html | 1 + .../admin/templates/admin/change_form.html | 1 + .../admin/templates/admin/change_list.html | 1 + .../contrib/admin/templates/admin/login.html | 1 + .../registration/password_change_form.html | 2 ++ .../registration/password_reset_confirm.html | 1 + .../registration/password_reset_form.html | 1 + tests/admin_changelist/tests.py | 18 ++++++++++++++++++ tests/admin_views/tests.py | 18 ++++++++++++++++++ tests/auth_tests/test_templates.py | 19 +++++++++++++++++++ 10 files changed, 63 insertions(+) diff --git a/django/contrib/admin/templates/admin/auth/user/change_password.html b/django/contrib/admin/templates/admin/auth/user/change_password.html index 6801fe5fa7..c9a494dc19 100644 --- a/django/contrib/admin/templates/admin/auth/user/change_password.html +++ b/django/contrib/admin/templates/admin/auth/user/change_password.html @@ -2,6 +2,7 @@ {% load i18n static %} {% load admin_urls %} +{% block title %}{% if form.errors %}{{ _('Error:') }} {% endif %}{{ block.super }}{% endblock %} {% block extrastyle %} {{ block.super }} diff --git a/django/contrib/admin/templates/admin/change_form.html b/django/contrib/admin/templates/admin/change_form.html index 09ef954e5c..b9bde30018 100644 --- a/django/contrib/admin/templates/admin/change_form.html +++ b/django/contrib/admin/templates/admin/change_form.html @@ -1,6 +1,7 @@ {% extends "admin/base_site.html" %} {% load i18n admin_urls static admin_modify %} +{% block title %}{% if errors %}{{ _('Error:') }} {% endif %}{{ block.super }}{% endblock %} {% block extrahead %}{{ block.super }} {{ media }} diff --git a/django/contrib/admin/templates/admin/change_list.html b/django/contrib/admin/templates/admin/change_list.html index 310872b015..fa189102bb 100644 --- a/django/contrib/admin/templates/admin/change_list.html +++ b/django/contrib/admin/templates/admin/change_list.html @@ -1,6 +1,7 @@ {% extends "admin/base_site.html" %} {% load i18n admin_urls static admin_list %} +{% block title %}{% if cl.formset and cl.formset.errors %}{{ _('Error:') }} {% endif %}{{ block.super }}{% endblock %} {% block extrastyle %} {{ block.super }} diff --git a/django/contrib/admin/templates/admin/login.html b/django/contrib/admin/templates/admin/login.html index b61d9ec603..8c2c7d11ff 100644 --- a/django/contrib/admin/templates/admin/login.html +++ b/django/contrib/admin/templates/admin/login.html @@ -1,6 +1,7 @@ {% extends "admin/base_site.html" %} {% load i18n static %} +{% block title %}{% if form.errors %}{{ _('Error:') }} {% endif %}{{ block.super }}{% endblock %} {% block extrastyle %}{{ block.super }} {{ form.media }} {% endblock %} diff --git a/django/contrib/admin/templates/registration/password_change_form.html b/django/contrib/admin/templates/registration/password_change_form.html index fde2373e08..20c78210c6 100644 --- a/django/contrib/admin/templates/registration/password_change_form.html +++ b/django/contrib/admin/templates/registration/password_change_form.html @@ -1,5 +1,7 @@ {% extends "admin/base_site.html" %} {% load i18n static %} + +{% block title %}{% if form.errors %}{{ _('Error:') }} {% endif %}{{ block.super }}{% endblock %} {% block extrastyle %}{{ block.super }}{% endblock %} {% block userlinks %} {% url 'django-admindocs-docroot' as docsroot %}{% if docsroot %}{% translate 'Documentation' %} / {% endif %} {% translate 'Change password' %} / diff --git a/django/contrib/admin/templates/registration/password_reset_confirm.html b/django/contrib/admin/templates/registration/password_reset_confirm.html index a07645c97a..3866b5aead 100644 --- a/django/contrib/admin/templates/registration/password_reset_confirm.html +++ b/django/contrib/admin/templates/registration/password_reset_confirm.html @@ -1,6 +1,7 @@ {% extends "admin/base_site.html" %} {% load i18n static %} +{% block title %}{% if form.new_password1.errors or form.new_password2.errors %}{{ _('Error:') }} {% endif %}{{ block.super }}{% endblock %} {% block extrastyle %}{{ block.super }}{% endblock %} {% block breadcrumbs %}