Page MenuHomePhabricator

Wrong width for galleries on mobile
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:

Only one image per row. One column.

What should have happened instead?:

There should be as many images in a column as possible (within reason, so keeping a gap).

I've fixed this on the main page with CSS. See: https://species.m.wikimedia.org/wiki/Main_Page
It's a hack and not ideal because I had to force width: auto !important; which is not the same as keeping widths of images. See: https://species.wikimedia.org/w/index.php?title=Template:MP/styles.css&oldid=9072279#L-63

Software version (skip for WMF-hosted wikis like Wikipedia): wiki.

Other information (browser name/version, screenshots, etc.):

Current defaults:

obraz.png (915×576 px, 286 KB)

Expected something more like this:

obraz.png (915×576 px, 475 KB)

This rule seems to cause problems in Minerva:

@media all and (max-width: 720px) {
  .gallery .gallerybox {
    width: 100% !important;
  }
}

Not sure why this was added. I checked various types or galleries and it seems that without that all galleries look better. Maybe traditional gallery could be centered instead?

Event Timeline

This behavior appears to originate from https://phabricator.wikimedia.org/diffusion/SMIN/browse/master/skinStyles/mediawiki.page.gallery.styles/tablet.less

Tracing back the origin of this rule, it appears to have been added by @Jdlrobson in September 2014 in this commit to MobileFrontend: https://phabricator.wikimedia.org/rEMFRa29b2ad034ba42bae8014cb333177a60b8af4b75 to address T72684. hacks.css was split from MobileFrontend to MinervaNeue in April 2018.

Based on the name of the file and the use of the (deprecated) token width-breakpoint-tablet as the breakpoint, it seems like the intention was to only apply this rule to tablets. However, as noted in this issue, it applies to any screen narrower than 720px, so also applies to phones.

Note that this issue is not exclusive to mode=packed — it affects all gallery modes. The following are examples of the different gallery modes from Help:Gallery tag, all displaying this same issue.

Screenshot 2024-03-16 at 22-57-22 Help Gallery tag - Wikipedia.png (915×412 px, 174 KB)
Screenshot 2024-03-16 at 22-57-08 Help Gallery tag - Wikipedia.png (915×412 px, 121 KB)
Screenshot 2024-03-16 at 22-56-52 Help Gallery tag - Wikipedia.png (915×412 px, 113 KB)