Making WordPress.org

Opened 4 months ago

Last modified 4 months ago

#8285 reopened enhancement

Plugin Directory: Lightbox images are too small

Reported by: alanjacobmathew Owned by: thilinah
Priority: normal Milestone:
Component: Plugin Directory Keywords: has-screenshots has-patch
Cc:

Description

The lightbox images/screenshots in the plugin directory are so small, that the purpose of having a lightbox is negated.

It'd be better if the lightbox image is the same size as that of original size.

Example: ​https://wordpress.org/plugins/woocommerce/

Attachments (2)

lightbox-small.png​ (26.6 KB ) - added by alanjacobmathew 4 months ago.
Screenshot 2026-06-09 at 12.35.56 pm.png​ (3.4 MB ) - added by dd32 4 months ago.

Change History (22)

#1 @dd32
4 months ago

@alanjacobmathew Can you let us know what browser and screen size you're working with here?

I've checked with Chrome/Safari/Firefox and it appears to be at a decent size to me.

FYI @alexodiy incase you have any thoughts.

#2 follow-up: @dd32
4 months ago

  • Keywords needs-patch added

I was able to duplicate it on a non-hdpi device. Chrome on Linux via remote desktop. Screen size 1280Wx900H

Ref: #8083 cc @thilinah

This ticket was mentioned in ​PR #686 on ​WordPress/wordpress.org by ​@thilinah.


4 months ago
#3

  • Keywords has-patch added; needs-patch removed

## Summary

The screenshot gallery lightbox (added in #622) had two production-only bugs:

  1. Image too small — the enlarged image was capped at the 900px Photon thumbnail instead of showing the full-resolution screenshot.
  2. Image duplicated — the screenshot rendered twice, stacked vertically.

Both are fixed here. They were related: fixing (1) is what surfaced (2).

## Background

Plugin screenshots are external ps.w.org assets with no real attachment, so each core/image block is given a *synthetic* attachment ID. Core's lightbox renderer treats that ID as a genuine attachment:

So the lightbox had no full-resolution source to enlarge and no real dimensions, falling back to the thumbnail's Photon-shrunk size.

This was not surfaced during sandbox testing because the Photon srcset is gated to production only photon_srcset() bails on non-production environments.

With no srcset on the sandbox, the thumbnail <img> loads the full-resolution ps.w.org original, so the thumbnail's natural size is the full image and the lightbox looked correct. Only on production, where Photon caps the thumbnail at ≤900px, did the bug appear — and the duplicate-image bug below was likewise masked because the enlarged container had no source to render.

#### Fix

  1. Repair the lightbox metadata (class-screenshots.php)

A new render_block_core/image filter (priority 20, after core's priority-15 lightbox pass) overrides the interactivity state for our screenshot blocks with the real uploadedSrc, targetWidth/targetHeight, and clears lightboxSrcset so the enlarged view loads the lossless original instead of a capped Photon candidate. Core keys this state by a per-render uniqid(), so the filter reads that key back out of the rendered markup. wp_interactivity_state() merges later-call-wins, so the corrected values replace the broken ones. Applied on all environments so sandbox and production behave identically.

  1. Stop stacking the lightbox's two image containers (gallery-lightbox-enhancements)

The caption polyfill forced core's two center-overlapping .lightbox-image-container siblings to position: relative, dropping them into normal flow and stacking them vertically. This only ever looked correct because the enlarged container was empty (bug 1 above). Once that container held a real image, the screenshot rendered twice.

  • CSS: removed the position: relative override so core's absolute center-overlap is restored.
  • JS: the caption is now mounted into the top (full-resolution) container so it isn't occluded by the enlarged image.

#### Testing

## Closes / refs

#### Screenshots

Before:

https://github.com/user-attachments/assets/7e72b4eb-d65a-4328-a557-6e6f6ba1e8e6

After:

https://github.com/user-attachments/assets/05a8eac1-8ff7-4e9e-a084-67168213415e

https://github.com/user-attachments/assets/98863060-e94a-4163-a2ff-ca4ef703baba

#4 in reply to: ↑ 2 @thilinah
4 months ago

Replying to dd32:

I was able to duplicate it on a non-hdpi device. Chrome on Linux via remote desktop. Screen size 1280Wx900H

Ref: #8083 cc @thilinah

@dd32 I'm looking into this. I'll be able to merge the fix today.

#5 @dd32
4 months ago

  • Owner set to thilinah
  • Status new → assigned

This ticket was mentioned in ​PR #689 on ​WordPress/wordpress.org by ​@thilinah.


4 months ago
#6

## Summary

The screenshot gallery lightbox (added in #622) had two production-only bugs:

  1. Image too small — the enlarged image was capped at the 900px Photon thumbnail instead of showing the full-resolution screenshot.
  2. Image duplicated — the screenshot rendered twice, stacked vertically.

Both are fixed here. They were related: fixing (1) is what surfaced (2).

## Background

Plugin screenshots are external ps.w.org assets with no real attachment, so each core/image block is given a *synthetic* attachment ID. Core's lightbox renderer treats that ID as a genuine attachment:

So the lightbox had no full-resolution source to enlarge and no real dimensions, falling back to the thumbnail's Photon-shrunk size.

This was not surfaced during sandbox testing because the Photon srcset is gated to production only photon_srcset() bails on non-production environments.

With no srcset on the sandbox, the thumbnail <img> loads the full-resolution ps.w.org original, so the thumbnail's natural size is the full image and the lightbox looked correct. Only on production, where Photon caps the thumbnail at ≤900px, did the bug appear — and the duplicate-image bug below was likewise masked because the enlarged container had no source to render.

## Fix

  1. Repair the lightbox metadata (class-screenshots.php)

A new render_block_core/image filter (priority 20, after core's priority-15 lightbox pass) overrides the interactivity state for our screenshot blocks with the real uploadedSrc, targetWidth/targetHeight, and clears lightboxSrcset so the enlarged view loads the lossless original instead of a capped Photon candidate. Core keys this state by a per-render uniqid(), so the filter reads that key back out of the rendered markup. wp_interactivity_state() merges later-call-wins, so the corrected values replace the broken ones. Applied on all environments so sandbox and production behave identically.

  1. Stop stacking the lightbox's two image containers (gallery-lightbox-enhancements)

The caption polyfill forced core's two center-overlapping .lightbox-image-container siblings to position: relative, dropping them into normal flow and stacking them vertically. This only ever looked correct because the enlarged container was empty (bug 1 above). Once that container held a real image, the screenshot rendered twice.

  • CSS: removed the position: relative override so core's absolute center-overlap is restored.
  • JS: the caption is now mounted into the top (full-resolution) container so it isn't occluded by the enlarged image.

## Testing

## Closes / refs

## Screenshots

Before:

https://github.com/user-attachments/assets/7e72b4eb-d65a-4328-a557-6e6f6ba1e8e6

After:

https://github.com/user-attachments/assets/05a8eac1-8ff7-4e9e-a084-67168213415e

https://github.com/user-attachments/assets/98863060-e94a-4163-a2ff-ca4ef703baba

​@thilinah commented on ​PR #686:


4 months ago
#7

Closed this as I used the wrong workflow.

New PR: ​https://github.com/WordPress/wordpress.org/pull/689

CC: @boro @dd32

​@dd32 commented on ​PR #686:


4 months ago
#8

@thilinah FWIW It doesn't really matter what repo the branch was filed on. Yes, preferably do your own fork, but it doesn't matter if it's a branch on this repo, especially for things that you're going to merge shortly.

​@thilinah commented on ​PR #689:


4 months ago
#9

Suggestion from @alanjacobmathew on ​closed PR

The 'wp-lightbox-caption', better if it is placed outside the image. That will make sure the screenshots can follow the brand-guidelines too if needed. Right now, if the image has a white shade, the caption becomes nearly unreadable. And most screenshot taken of the admin-screen is nearly white(Take the example of Yoast SEO screenshot above)

Thanks for the suggestion @alanjacobmathew. Since the fix for the original issue (small lightbox image) is a bit urgent, I'll differ this to another PR.

​@thilinah commented on ​PR #686:


4 months ago
#10

I just created a issue in trac, and saw this conversation. So adding to it

The 'wp-lightbox-caption', better if it is placed outside the image. That will make sure the screenshots can follow the brand-guidelines too if needed. Right now, if the image has a white shade, the caption becomes nearly unreadable. And most screenshot taken of the admin-screen is nearly white(Take the example of Yoast SEO screenshot above)

Thanks @alanjacobmathew, I've responded to this here: ​https://github.com/WordPress/wordpress.org/pull/689#issuecomment-4656555620

#11 @alanjacobmathew
4 months ago

Screen size: 1366 x 768

FF and chromium. Win10

​@annebovelett commented on ​PR #689:


4 months ago
#12

Thank you, @thilinah! Where can I find that PR / Issue for the text outside the image? A second point to that is that the text should be left-aligned. Centered it's hard to read for people with dyslexia (I'm one of the 15% of all users this affects as soon as it's more than one line).

Suggestion from @alanjacobmathew on ​closed PR

The 'wp-lightbox-caption', better if it is placed outside the image. That will make sure the screenshots can follow the brand-guidelines too if needed. Right now, if the image has a white shade, the caption becomes nearly unreadable. And most screenshot taken of the admin-screen is nearly white(Take the example of Yoast SEO screenshot above)

Thanks for the suggestion @alanjacobmathew. Since the fix for the original issue (small lightbox image) is a bit urgent, I'll differ this to another PR.

cc: @stevejonesdev

​@thilinah commented on ​PR #689:


4 months ago
#13

A second point to that is that the text should be left-aligned. Centered it's hard to read for people with dyslexia

Thanks for bringing this up @Bovelett. I've updated the text alignment based on locale, to either left or right.

https://github.com/user-attachments/assets/2ebd6ca2-64db-4dca-b027-36ed6bbed2f1

https://github.com/user-attachments/assets/85c84629-ef4c-4366-8d47-77b9f294485b

Where can I find that PR / Issue for the text outside the image?

I'll open the new PR after merging this.

​@alh0319 commented on ​PR #689:


4 months ago
#14

@thilinah re:

Since the fix for the original issue (small lightbox image) is a bit urgent, I'll differ this to another PR.

It's safe to say that the caption readability is a larger failure than the image size. Small images are annoying, unreadable text is a literal blocker, and a failure of the Web Content Accessibility Guidelines 2.2 standard that WordPress says it will meet.

Here is an example of an image on my plugin, ​Accessibility Checker:
https://github.com/user-attachments/assets/3bfd719c-d198-4eb9-ab70-442dd87dadad

This issue that @alanjacobmathew reported should be treated as urgent.

#15 @thilinah
4 months ago

  • Resolution → fixed
  • Status assigned → closed

In 14955:

Plugin Directory: lightbox image is rendered smaller than expected

Props thilinah, bor0, annebovelett, alh0319.
Closes ​https://github.com/WordPress/wordpress.org/pull/689.
Fixes #8285.

​@alh0319 commented on ​PR #689:


4 months ago
#16

There's a tcket from @stevejonesdev for the caption issue in meta trac here.

#17 @alanjacobmathew
4 months ago

  • Resolution fixed
  • Status closed → reopened

@thilinah

Reopening this

Though it works fine for the examples mentioned above, there is an issue, if the source image height is longer that the vh of the screen, the images becomes small, on lightbox view.

Example: Open the 4th image of ​https://wordpress.org/plugins/easyfonts/

#18 @thilinah
4 months ago

  • Type defect (bug) → enhancement

@alanjacobmathew agreed this is a valid concern.

But I don't think it's urgent, though, since the image loaded in the lightbox for the 4th screenshot is already the full-size one, and users who need to see the whole thing at full resolution can still open it in a new tab.

To explain the constraint: the lightbox fits each image to the viewport without cropping, so it's bounded by both width and height. For a landscape image, width is the limiting dimension and it fills most of the screen.

For a portrait image taller than the viewport, height becomes the limiting dimension, so it scales down to a narrow column and covers less screen area, even though it's as large as it can be without cropping or distortion. There's no way to make a tall portrait image fill a landscape viewport without cropping it or upscaling it, both of which are worse, so this is partly just the geometry of fit-to-viewport sizing.

As a fix, I'd suggest adding a zoom button to the lightbox. Clicking it would either zoom the image in place (toward 1:1) or open the full-size image in a new tab, effectively restoring the older screenshot behavior of viewing the image at full size, while keeping the default lightbox view clean.

That gives users who want details, an explicit way to get it, without changing the fit-to-viewport default that works well for the landscape screenshots.

Happy to take a pass at this if there's agreement on the approach.

#19 @tusharaddweb
4 months ago

I want to thank @alanjacobmathew for telling us about the problem with the viewport and for giving us an example from the easyfonts plugin.

I looked into this problem. I can see that it is true. When we take a screenshot in portrait mode it gets a lot smaller when the viewport is not very tall even though the picture is already the size.

It makes sense that we do not want the picture to be bigger than the viewport because this helps prevent things from getting messy and helps keep everything looking nice.. I think this can be a problem when we have tall screenshots and we want to see the details clearly.

I think it would be an idea to have a special way to zoom in on the picture like a button that says open full size when we are looking at the picture, in a lightbox. This way we can make sure that everything is easy to use and safe.

If someone wants to try to make this zoom feature work I can help test it on screens and see how it looks.

#20 @alexodiy
4 months ago

Thanks @thilinah for the update 🙂 Honestly, Fancybox 5 solves most of this kind of thing out of the box. But I still think the right direction here is to keep building on the core lightbox, and I will keep thinking about whether we can add a clean zoom follow up for tall screenshots without accidentally rebuilding Fancybox piece by piece.

Note: See TracTickets for help on using tickets.