Fix different column gallery image sizes#2543
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## fix/2449-equal-column #2543 +/- ##
=========================================================
+ Coverage 70.42% 70.47% +0.05%
=========================================================
Files 91 91
Lines 7865 7879 +14
=========================================================
+ Hits 5539 5553 +14
Misses 2326 2326
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR extends the Auto Sizes (“enhanced responsive images”) logic for core/gallery so sizes can better reflect actual image widths when the gallery has incomplete rows (e.g., different columns vs. image counts), and adds/updates PHPUnit coverage for those scenarios.
Changes:
- Track total gallery images and compute per-image relative width based on whether an image falls in a full vs. incomplete row.
- Add a new data-driven gallery test matrix for varying
(image_count, columns)combinations. - Update gallery test markup generation to emit column-specific gallery classes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| plugins/auto-sizes/includes/improve-calculate-sizes.php | Adds gallery context and per-image width logic for incomplete rows when calculating container-relative width. |
| plugins/auto-sizes/tests/test-improve-calculate-sizes.php | Adds expanded gallery test coverage and adjusts gallery markup helper to include columns classes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
westonruter
left a comment
There was a problem hiding this comment.
Probably should get this merged into the other branch since this is a critical change which probably belongs in that initial PR.

Summary
Part of #2449
Follow-up to #2534
Relevant technical choices
How to Test
Use of AI Tools
N/A