Re: [Django] #35456: Fieldset title inside a collapsed StackedInline are `h3` but on errors are shown as `h2`

5 views
Skip to first unread message

Django

unread,
May 17, 2024, 10:06:12 AM5/17/24
to django-...@googlegroups.com
#35456: Fieldset title inside a collapsed StackedInline are `h3` but on errors are
shown as `h2`
-------------------------------------+-------------------------------------
Reporter: Natalia Bidart | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: contrib.admin | Version: 5.0
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by Natalia Bidart):

Replying to [comment:1 Sarah Boyce]:
> Thank you for the models, admin and screenshots!
>
> I think the core issue here you are reporting is that the heading tag
should not change between the collapse and expand state. When there is an
error, this is in the expanded state but this header tag switching
behaviour also happens when clicking on show and hide.

In general I agree with the triaging of this ticket but please note a
small detail: the heading tag does not in fact change. The current
behavior (in both `main` and in the PR fixing #35189) is that on error,
the template would ''not include'' the "collapsibility" capabilities in
the header, it would present the fieldset with error as a fieldset that is
not collapsible at all (and there is no way to close it because, on error,
the "expand/hide" capabilities are not there). But the headings are in
both cases `h2`, only that they are notoriously differently styled.

> What the header tags should be is also interesting. This article helped
me understand: https://developer.mozilla.org/en-
US/docs/Web/HTML/Element/Heading_Elements

Sarah and I had a chat about this (because it's quite confusing) and we
agreed that in the referenced ticket/PR, the "Add Foo" page is skipping a
header, but the "Change Foo" is not. Given that in `main` no header is
skipped, we'll tweak the PR to use `h2` for fieldsets keeping current
heading hierarchy.

OTOH, in `main` there is an issue with fieldsets headers inside inlines,
where `h2` headings are used for the fieldset title but these are inside
`h3` headings which are the inline title. This is being fixed along with
#35189 by using `h4` in these cases.

> I am going to mark this as a duplicate of #35189 as what you have
reported I believe is covered and will be fixed there 👍

Makes sense, thank you!
--
Ticket URL: <https://code.djangoproject.com/ticket/35456#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Reply all
Reply to author
Forward
0 new messages