Make WordPress Core

Opened 4 years ago

#51828 new defect (bug)

gallery items not aligned when row has less items than column count

Reported by: rolekwp's profile rolekwp Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version: 5.5.3
Component: Gallery Keywords: has-patch has-screenshots
Focuses: Cc:


If a gallery contains not enough images to fill up all columns, in some cases the layout looks wrong. In the last row, the images are spaced evenly over the row, but the alignment is off.

Screenshot with problem:

The problem, as far as I can see, is that there aren't enough gallery-item flex boxes to ensure the layout matches the layout of a full row.
I simple fix (although I am altogether not sure if this is the right way to go) is to end the row with just as many empty gallery items as needed to fill up the row. The attached patch does this, and seems to fix the problem.

Screenshot with fix:

I would also be fine if the three images were spaced evenly over the row, but then the left and right alignment should be the same. I don't know how that could be achieved.

This is with the neve theme. I don't have a reproduction with the default theme, sorry.

Attachments (1)

gallery-item-alignment.patch (499 bytes) - added by rolekwp 4 years ago.

Download all attachments as: .zip

Change History (1)

Note: See TracTickets for help on using tickets.