diff options
| author | Marijke Luttekes <mail@marijkeluttekes.dev> | 2024-05-20 14:39:09 -0300 |
|---|---|---|
| committer | nessita <124304+nessita@users.noreply.github.com> | 2024-05-22 00:13:55 -0300 |
| commit | e4a693f50a8342ed1a54b74e1a202b44c8e62981 (patch) | |
| tree | fe5924414b2edafaec2ee4c7709cbf86dfc94220 /docs | |
| parent | 01ed59f753139afb514170ee7f7384c155ecbc2d (diff) | |
Fixed #35189 -- Improved admin collapsible fieldsets by using <details> elements.
This work improves the accessibility of the add and change pages in the
admin site by adding <details> and <summary> elements to the collapsible
fieldsets. This has the nice side effect of no longer requiring custom
JavaScript helpers to implement the fieldsets' show/hide capabilities.
Thanks to James Scholes for the accessibility advice, and to Sarah Boyce
and Tom Carrick for reviews.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/contrib/admin/index.txt | 21 | ||||
| -rw-r--r-- | docs/releases/5.1.txt | 6 |
2 files changed, 22 insertions, 5 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 2a5652c24b..b7e94c7387 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -424,9 +424,16 @@ subclass:: "classes": ["wide", "collapse"], } - Fieldsets with the ``collapse`` style will be initially collapsed in - the admin and replaced with a small "click to expand" link. Fieldsets - with the ``wide`` style will be given extra horizontal space. + Fieldsets with the ``wide`` style will be given extra horizontal + space in the admin interface. + Fieldsets with a name and the ``collapse`` style will be initially + collapsed, using an expandable widget with a toggle for switching + their visibility. + + .. versionchanged:: 5.1 + + ``fieldsets`` using the ``collapse`` class now use ``<details>`` + and ``<summary>`` elements, provided they define a ``name``. * ``description`` A string of optional extra text to be displayed at the top of each @@ -2308,8 +2315,12 @@ The ``InlineModelAdmin`` class adds or customizes: A list or tuple containing extra CSS classes to apply to the fieldset that is rendered for the inlines. Defaults to ``None``. As with classes configured in :attr:`~ModelAdmin.fieldsets`, inlines with a ``collapse`` - class will be initially collapsed and their header will have a small "show" - link. + class will be initially collapsed using an expandable widget. + + .. versionchanged:: 5.1 + + ``fieldsets`` using the ``collapse`` class now use ``<details>`` and + ``<summary>`` elements, provided they define a ``name``. .. attribute:: InlineModelAdmin.extra diff --git a/docs/releases/5.1.txt b/docs/releases/5.1.txt index 68315205df..e4f0b37402 100644 --- a/docs/releases/5.1.txt +++ b/docs/releases/5.1.txt @@ -419,6 +419,12 @@ Miscellaneous a ``<footer>`` tag instead of a ``<div>``, and also moved below the ``<div id="main">`` element. +* In order to improve accessibility, the expandable widget used for + :attr:`ModelAdmin.fieldsets <django.contrib.admin.ModelAdmin.fieldsets>` and + :attr:`InlineModelAdmin.fieldsets <django.contrib.admin.InlineModelAdmin>`, + when the fieldset has a name and use the ``collapse`` class, now includes + ``<details>`` and ``<summary>`` elements. + * :meth:`.SimpleTestCase.assertURLEqual` and :meth:`~django.test.SimpleTestCase.assertInHTML` now add ``": "`` to the ``msg_prefix``. This is consistent with the behavior of other assertions. |
