diff --git a/AUTHORS b/AUTHORS index 597fe7991bff..c480402993a1 100644 --- a/AUTHORS +++ b/AUTHORS @@ -775,6 +775,7 @@ answer newbie questions, and generally made Django that much better: Mridul Dhall msaelices msundstr + Muhammad Usman Mushtaq Ali Mykola Zamkovoi Nadège Michel diff --git a/django/contrib/admin/static/admin/css/forms.css b/django/contrib/admin/static/admin/css/forms.css index 73ee40274aef..6249e55772b0 100644 --- a/django/contrib/admin/static/admin/css/forms.css +++ b/django/contrib/admin/static/admin/css/forms.css @@ -218,7 +218,8 @@ fieldset .fieldBox { /* WIDE FIELDSETS */ -.wide label { +.wide label, +.wide legend { width: 200px; } diff --git a/django/contrib/admin/static/admin/css/rtl.css b/django/contrib/admin/static/admin/css/rtl.css index 713f9f4188f3..ba4d0bf549dd 100644 --- a/django/contrib/admin/static/admin/css/rtl.css +++ b/django/contrib/admin/static/admin/css/rtl.css @@ -124,7 +124,8 @@ thead th.sorted .text { /* FORMS */ -.aligned label { +.aligned label, +.aligned legend { padding: 0 0 3px 1em; } diff --git a/docs/releases/6.0.3.txt b/docs/releases/6.0.3.txt index 1dff197d066b..3f4972529ee4 100644 --- a/docs/releases/6.0.3.txt +++ b/docs/releases/6.0.3.txt @@ -15,3 +15,6 @@ Bugfixes * Fixed :exc:`AttributeError` when subclassing builtin lookups and neglecting to :ref:`override` ``as_sql()`` to accept any sequence (:ticket:`36934`). + +* Fixed a visual regression where fieldset legends were misaligned in the admin + (:ticket:`36920`). diff --git a/tests/admin_views/test_password_form.py b/tests/admin_views/test_password_form.py index d448943b0459..15f6037d07d8 100644 --- a/tests/admin_views/test_password_form.py +++ b/tests/admin_views/test_password_form.py @@ -1,6 +1,7 @@ from django.contrib.admin.tests import AdminSeleniumTestCase from django.contrib.auth.models import User from django.test import override_settings +from django.test.selenium import screenshot_cases from django.urls import reverse @@ -142,3 +143,12 @@ def test_change_password_for_existing_user(self): # Only the set password submit button is visible. self.assertIs(submit_set.is_displayed(), True) self.assertIs(submit_unset.is_displayed(), False) + + @screenshot_cases(["desktop_size", "mobile_size", "rtl", "dark", "high_contrast"]) + def test_fieldset_legend_wide_alignment(self): + user_add_url = reverse("auth_test_admin:auth_user_add") + self.admin_login(username="super", password="secret") + self.selenium.get(self.live_server_url + user_add_url) + + # The fieldset legend is aligned with other fields. + self.take_screenshot("fieldset_legend_wide")