Skip to content

Fix different column gallery image sizes#2543

Merged
mukeshpanchal27 merged 16 commits into
fix/2449-equal-columnfrom
fix/2449-different-columns
Jul 10, 2026
Merged

Fix different column gallery image sizes#2543
mukeshpanchal27 merged 16 commits into
fix/2449-equal-columnfrom
fix/2449-different-columns

Conversation

@mukeshpanchal27

Copy link
Copy Markdown
Member

Summary

Part of #2449

Follow-up to #2534

Relevant technical choices

How to Test

  1. Add a Gallery block.
  2. Insert any number of images
  3. Set different columns
  4. Verify the image sizes.

Use of AI Tools

N/A

@mukeshpanchal27 mukeshpanchal27 self-assigned this Jun 19, 2026
@mukeshpanchal27 mukeshpanchal27 added [Type] Enhancement A suggestion for improvement of an existing feature no milestone PRs that do not have a defined milestone for release [Plugin] Enhanced Responsive Images Issues for the Enhanced Responsive Images plugin (formerly Auto Sizes) labels Jun 19, 2026
@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.47%. Comparing base (a7f0b48) to head (6990e4c).

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              
Flag Coverage Δ
multisite 70.47% <100.00%> (+0.05%) ⬆️
single 35.81% <100.00%> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread plugins/auto-sizes/tests/test-improve-calculate-sizes.php Outdated
Comment thread plugins/auto-sizes/tests/test-improve-calculate-sizes.php Outdated
Comment thread plugins/auto-sizes/tests/test-improve-calculate-sizes.php
Comment thread plugins/auto-sizes/includes/improve-calculate-sizes.php
Comment thread plugins/auto-sizes/tests/test-improve-calculate-sizes.php Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comment thread plugins/auto-sizes/tests/test-improve-calculate-sizes.php
Comment thread plugins/auto-sizes/includes/improve-calculate-sizes.php Outdated
Comment thread plugins/auto-sizes/includes/improve-calculate-sizes.php Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread plugins/auto-sizes/tests/test-improve-calculate-sizes.php
@mukeshpanchal27 mukeshpanchal27 marked this pull request as ready for review June 26, 2026 04:51
@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: mukeshpanchal27 <mukesh27@git.wordpress.org>
Co-authored-by: westonruter <westonruter@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread plugins/auto-sizes/tests/test-improve-calculate-sizes.php

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread plugins/auto-sizes/includes/improve-calculate-sizes.php Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread plugins/auto-sizes/tests/test-improve-calculate-sizes.php
@westonruter

Copy link
Copy Markdown
Member

Given this Gallery:

image

I see successfully that the first two images have sizes="(max-width: 322px) 100vw, 322px" and the last has sizes="(max-width: 645px) 100vw, 645px".

@westonruter westonruter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should get this merged into the other branch since this is a critical change which probably belongs in that initial PR.

@mukeshpanchal27 mukeshpanchal27 merged commit 8813370 into fix/2449-equal-column Jul 10, 2026
20 checks passed
@mukeshpanchal27 mukeshpanchal27 deleted the fix/2449-different-columns branch July 10, 2026 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no milestone PRs that do not have a defined milestone for release [Plugin] Enhanced Responsive Images Issues for the Enhanced Responsive Images plugin (formerly Auto Sizes) [Type] Enhancement A suggestion for improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants