Repository navigation
[WC-3633] fix: image lightbox inherit image sizing - #2511
Merged
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
gjulivan
force-pushed
the
combobox/fix-lightbox
branch
from
November 13, 2026 14:33
4db808b to
b8f7b8e
Compare
This comment has been minimized.
This comment has been minimized.
gjulivan
force-pushed
the
combobox/fix-lightbox
branch
from
November 16, 2026 21:04
b8f7b8e to
088ba67
Compare
This comment has been minimized.
This comment has been minimized.
leonardomendix
previously approved these changes
Nov 17, 2026
…-ratio styles
- Give the lightbox image its own class so its max width and height win over
Atlas's `img.img-thumbnail { max-width: 100% }`, which capped a thumbnail at
half the window.
- Never show the enlarged image smaller than the image on the page: measure the
image on click and, when that is larger than the natural size, set a width
that keeps the aspect ratio and still fits the viewport.
- Drop aspect-ratio, object-fit and object-position from the inline style passed
to the lightbox image, so it is not cropped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ContentImage and BackgroundImage overwrote the height from constructStyleObject with getStyle(), which only handled pixels and percentage and returned "" for viewport, so a height in vh was dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gjulivan
force-pushed
the
combobox/fix-lightbox
branch
from
November 17, 2026 12:33
26166b3 to
4acea0e
Compare
uicontent
approved these changes
Nov 17, 2026
gjulivan
enabled auto-merge (rebase)
November 17, 2026 12:35
Contributor
AI Code Review
What was reviewed
Skipped (out of scope): none CI: pending: Run code quality check, Plan E2E matrix, sigridci · unrelated failures: security/snyk (external scanner) Questions
Positives
|
leonardomendix
approved these changes
Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request type
Bug fix (non-breaking change which fixes an issue)
Description
Fixes WC-3633: with On click set to Enlarge, the enlarged image could be smaller than the image on the page.
Cause. The lightbox rendered a clone of the image on the page (
cloneElement(content, ...)), so it kept that image's inline width, height, min-height and max-height..mx-image-viewer-lightboxisposition: fixedwith no width, so it shrinks to fit its content, and a percentage width then resolves against the image's own natural width. A 338 px image with Width 50% was shown 169 px wide, and with the max height of 250 px that is the default since 1.6.0, about 126 px. A max height capped the enlarged image at the height of the image on the page, and a pixel width kept it at the size on the page.Fix.
<img>without the sizing styles (width, height, min/max width, min/max height). Other inline styles, the alt text and theimg-thumbnailclass are kept, as before.Image.scssshows the lightbox image at its natural size, scaled down to fit the viewport (max-width: 90vw; max-height: 85vh), keeping the aspect ratio.Behavior change to note. With a fixed pixel width smaller than the image, Enlarge now shows the image larger than on the page. Before, it stayed the same size.
Verified in a Mendix 11.12.5 app with Image widgets showing a 338 × 335 px image, measured with Playwright at 1440 × 900:
At a 400 × 300 viewport the enlarged image is 257 × 255 (85vh), centred, aspect ratio kept.
pnpm testpasses (45 tests).pnpm lintreports no errors; its one warning (import order inImage.tsx) was already there.What should be covered while testing?
thumb=truein its URL).🤖 Generated with Claude Code