Make WordPress Core

Opened 9 months ago

#41884 new defect (bug)

Twenty Seventeen: responsive (gallery) images are too large

Reported by: nosilver4u Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.8.1
Component: Bundled Theme Keywords:
Focuses: Cc:


It seems the sizes attribute used for gallery images on the Twenty Seventeen theme is a bit off. When viewed on the front page or an archive page, instead of the selected thumbnail images (150px), the browser is choosing the medium size at 600w, which I believe is based on the "default" of 580px. Even worse, when viewing a single post with a gallery, the "size" attribute is 100vw, which means a 1080p screen forces the browser to load the largest image available (1024w in my case).

I switched over to the Twenty Sixteen theme and it does not seem to have this same problem.

I also tested this on another site, and initially it was only showing thumbs (as expected). I compared the media settings, and realized the two sites were different.

So there is one other thing that must be true to cause this behavior. Under the Media settings, if you have the thumbnail cropping turned off, this is the trigger.

So essentially, when the thumbs are 150x113 instead of 150x150, the Twenty Seventeen theme adds all (or most of) the available sizes to the srcset list because it fails to find an exact match to display in the gallery.

You can see it in action here: https://test.shanebishop.net/2017/06/23/hello-world/

Change History (0)

Note: See TracTickets for help on using tickets.