1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

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>
This commit is contained in:
Marijke Luttekes
2024-05-20 14:39:09 -03:00
committed by nessita
parent 01ed59f753
commit e4a693f50a
11 changed files with 119 additions and 88 deletions

View File

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