Opened 14 months ago

Closed 3 weeks ago

#35353 closed Bug (duplicate)

SelectFilter2.js puts the label for Django Admin filter fields in the wrong place

Reported by: Phil Gyford Owned by: nobody
Component: contrib.admin Version: 5.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes

Description (last modified by Phil Gyford)

The label for Django Admin filter fields is appearing after the fields, instead of before. I'm using v5.0.4.

If I use the previous version of static/admin/SelectFilter2.js https://github.com/django/django/blob/e3a4cee081cf60650b8824f0646383b79cb110e7/django/contrib/admin/static/admin/js/SelectFilter2.js then the problem is fixed.

(Via the forum https://forum.djangoproject.com/t/label-not-rendering-above-field/29821/)

Attachments (4)

Screenshot of label in wrong place.png (113.9 KB ) - added by Phil Gyford 14 months ago.
Screenshot of label in wrong place
HTML of label in wrong place.png (83.1 KB ) - added by Phil Gyford 14 months ago.
HTML showing label in wrong place
Screenshot of label using previous version of SelectFilter2.js.png (113.2 KB ) - added by Phil Gyford 14 months ago.
Screenshot of label using previous version of SelectFilter2.js
HTML of label using previous version of SelectFilter2.png (77.2 KB ) - added by Phil Gyford 14 months ago.
HTML of label using previous version of SelectFilter2.js

Download all attachments as: .zip

Change History (9)

by Phil Gyford, 14 months ago

Screenshot of label in wrong place

by Phil Gyford, 14 months ago

HTML showing label in wrong place

by Phil Gyford, 14 months ago

Screenshot of label using previous version of SelectFilter2.js

by Phil Gyford, 14 months ago

HTML of label using previous version of SelectFilter2.js

comment:1 by Phil Gyford, 14 months ago

Description: modified (diff)

comment:2 by Natalia Bidart, 14 months ago

Resolution: worksforme
Status: newclosed
UI/UX: set

Hello Phil, thank you for your report. I have seen the screenshots and the forum topic, but I'm not being able to reproduce. What you see may be a side effect of a custom CSS that you may have? Or a third party package providing a custom CSS? Or a lack of proper CSS reload/serve when upgrading?

Given that I can't reproduce in any way (I tried various screen sizes and screen modes), I'll be closing this ticket as invalid following the ticket triaging process. If you could provide a way to reliable reproduce, either by providing detailed instructions or a django minimal test project, please re-open with the new information.

You could also seek further debugging help in the forum by continuing the conversation there.

comment:3 by Zbigniew Skowron, 3 weeks ago

Resolution: worksforme
Status: closednew

This is a bug in django/contrib/admin/static/admin/js/SelectFilter2.js.
This code in SelectFilter2.js puts the widget before the label:

            // Make sure the selector div is at the beginning so that the
            // add link would be displayed to the right of the widget.
            from_box.parentNode.prepend(selector_div);

It works only if RelatedFieldWidgetWrapper is used, as the wrapper puts the widget inside a separate <div>, so prepend() doesn’t reorder widget with respect to the label.
Without the RelatedFieldWidgetWrapper we get the bug.

comment:4 by Sarah Boyce, 3 weeks ago

I believe this might be a duplicate of #36053

comment:5 by Sarah Boyce, 3 weeks ago

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top