Opened 3 weeks ago

Closed 3 days ago

Last modified 3 days ago

#36850 closed Bug (fixed)

Django Admin filter sidebar wraps if its inner content becomes too large

Reported by: Mark Owned by: Nilesh Pahari
Component: contrib.admin Version: 6.0
Severity: Release blocker Keywords: css
Cc: Antoliny Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes

Description (last modified by Jacob Walls)

In the course of ticket #36511 the layout of the changelist and its filter sidebar has been changed so that the sidebar seemingly should have a fixed width of 240px.

The flex-base property does not necessarily restrict the width of the sidebar if it's content demands more (which happens eg. for dropdowns with large titles). Combined with the flex: wrap attribute, the sidebar wraps if the table also demands more width than available and looks broken (see attachment).

This behavior can be simulated by giving a sidebar's and changelist's children some fixed, large width:

#changelist-filter-extra-actions {
  width: 290px;
}
#toolbar {
  width: 1000px;
}

The problem could be resolved by reverting to the previous flex layout, but the motivation for those changes is unclear to me from the ticket and related pr.

Should the width of the sidebar stick to 240px or - at it has been before - should the sidebar grow if necessary?

Does the new flex layout have any advantages to how it was in django <6?

Attachments (1)

Screenshot from 2026-01-07 15-00-57.png (53.2 KB ) - added by Mark 3 weeks ago.

Download all attachments as: .zip

Change History (18)

comment:1 by Mark, 3 weeks ago

Summary: Django Admin filter sidebar wraps if it's inner content becomes to largeDjango Admin filter sidebar wraps if it's inner content becomes too large

comment:2 by Mark, 3 weeks ago

Description: modified (diff)

comment:3 by Mark, 3 weeks ago

Description: modified (diff)

comment:4 by Mark, 3 weeks ago

Description: modified (diff)
Summary: Django Admin filter sidebar wraps if it's inner content becomes too largeDjango Admin filter sidebar wraps if its inner content becomes too large

comment:5 by Nilesh Pahari, 3 weeks ago

Owner: set to Nilesh Pahari
Status: newassigned

comment:6 by Jacob Walls, 3 weeks ago

Cc: Antoliny added
Description: modified (diff)
Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

comment:7 by Nilesh Pahari, 2 weeks ago

Has patch: set

comment:9 by Antoliny, 2 weeks ago

Thank you for reporting this issue Mark :)

The goal of #36511 was to ensure that filter elements are reached before table elements during tab navigation (accessibility improvement).
And of course, the existing layout should have been maintained.
As mentioned above, it should have been kept identical to the existing layout, and I think maintaining it is the best approach.
In a way that allows the sidebar to grow as it did before.

If we remove flex-wrap and add min-width to the area where the table exists, I think we'll get the same layout as before even when the filter element's width increases.
By the way, could you let me know how you discovered this issue?

I'm a bit unsure about how to write regression tests for this.

Version 0, edited 2 weeks ago by Antoliny (next)

comment:10 by Jacob Walls, 2 weeks ago

Patch needs improvement: set

in reply to:  9 comment:11 by Mark, 2 weeks ago

Alright, makes sense. Just wanted to make sure, the flex-wrap change does not have any accessibility implications I don't get. I see, you are already pretty far with the PR from Nilesh. Thanks to both of you :)

comment:12 by Nilesh Pahari, 2 weeks ago

Patch needs improvement: unset

comment:13 by Jacob Walls, 10 days ago

Patch needs improvement: set

comment:14 by Nilesh Pahari, 8 days ago

Patch needs improvement: unset

comment:15 by Jacob Walls, 3 days ago

Triage Stage: AcceptedReady for checkin

comment:16 by Jacob Walls <jacobtylerwalls@…>, 3 days ago

Resolution: fixed
Status: assignedclosed

In e92d1e3:

Fixed #36850 -- Prevented admin filter sidebar from wrapping below the changelist.

Removed flex-wrap from .changelist-form-container and added min-width to the
main content container to ensure proper layout behavior.
Regression in 6ea331907996a51842da55c1f8d65eea7b367c7d.

comment:17 by Jacob Walls <jacobtylerwalls@…>, 3 days ago

In c4429af:

[6.0.x] Fixed #36850 -- Prevented admin filter sidebar from wrapping below the changelist.

Removed flex-wrap from .changelist-form-container and added min-width to the
main content container to ensure proper layout behavior.
Regression in 6ea331907996a51842da55c1f8d65eea7b367c7d.

Backport of e92d1e3b7858981185e93d717c5727544d66b66e from main.

Note: See TracTickets for help on using tickets.
Back to Top