Automattic / Automattic/jetpack
Tiled Galleries: adjust currentWidth to make sure it's never smaller than the sum of images on gallery row
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
> originalWidth: 1140, currentWidth: 795 => resizeRatio is 0.6973684210526315
> - For the left column (single 800x800 image):
> Original width is 760px, so when scaled-down this becomes 760*0.6973684210526315 = 530px exactly
> - For the right column (two 800x800 images on top of each other):
> Original width is 380px, scaled-down width becomes 380**0.6973684210526315 = 265px exactly
> - The width of the two columns is now 530+265 = 795px.
> - Now, the gallery row:
> Its original width is 1140px, but when you multiply 1140*0.6973684210526315 you get 794.9999999999999 due to precision issues. This is then rounded down to 794px and obviously you can't fit the 795px wide content in a 794px wide space. The right column overflows and is hidden.
Reported here:
https://wordpress.org/support/topic/jetpack-tiled-mosaic-gallery-some-images-not-showing?replies=6&view=all#post-8236263
Contributor guide
Research direction
No file or test is named in the issue. Start by locating the Tiled Galleries row-width calculation and reproduce the reported 1140px/795px case; done means the calculated currentWidth is never smaller than the summed image widths, so the right column no longer overflows or gets hidden.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100