Plugin Directory: Try using core Gallery & Image blocks for screenshots#524
Plugin Directory: Try using core Gallery & Image blocks for screenshots#524ryelle wants to merge 1 commit intoWordPress:trunkfrom
Conversation
|
❤️ I was thinking about this, and whether there's any routinely maintained gallery block plugin that implements a slider-type we currently have. I then queried the number of screenshots plugins had, and found multiple with over 100 screenshots 🤯 Here's that data:
|
As a followup to this, I would suggest the overall height of the section is limited to ~3 rows of screenshots or an absolute arbitrary pixel count, with the rest hidden behind a |
|
This would also fix https://meta.trac.wordpress.org/ticket/2273 and render #67 obsolete. |
|
I really like the direction here of moving the screenshots UI to core Gallery blocks instead of continuing to patch the legacy React gallery. I tried this approach locally, and after working through it I think it points to a pretty clear solution for the remaining UX issues too. The current screenshots section is showing its age at this point. We have the long-running screenshots UI ticket in https://meta.trac.wordpress.org/ticket/2273, the lightbox request in https://meta.trac.wordpress.org/ticket/8083, the navigation issue in https://meta.trac.wordpress.org/ticket/7878, the lazy-loading issue in https://meta.trac.wordpress.org/ticket/5190, and now a fresh Chrome 146 regression in https://meta.trac.wordpress.org/ticket/8204 caused by the old Based on that, the direction that makes the most sense to me is:
After trying it locally, the main issue I ran into was not the Gallery block itself, but the screenshot content we need to handle. Plugin authors upload screenshots in very different formats. Some are tall, some are wide, some are square, some have captions, some do not, and caption length varies a lot too. Because of that, the standard layouts do not work especially well here:
That is why I think the cleanest version of this approach is a masonry-style layout, with captions not rendered visually in the grid at all. If captions are optional, missing, short, or very long, they make the gallery harder to scan and the layout less consistent. Keeping them in the lightbox only feels like the best compromise to me: the grid stays clean, and the caption is still available when someone opens the image. It also seems like a better long-term direction in general, because once this is based on Gutenberg blocks we would have more flexibility to adjust the gallery behavior later depending on the number and type of images, including switching layouts if that ever makes sense. For wordpress.org specifically, this would also let us modernize the current screenshots section in one step:
I am not specifically proposing a "3 rows / See more" limit as part of this comment. If we want to reduce the initial height of the section later, something like an expansion after the sixth image could be discussed separately, but for me that is secondary to the main layout and lightbox direction. The only real blocker I see is that lightbox captions still depend on WordPress/gutenberg#60469, since the current core lightbox does not yet pass figcaptions into the overlay. Related tickets / PRs for context:
If this direction makes sense, I would be happy to help move it forward. |
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |

This switches the plugin directory's screenshot section to use a pattern with core blocks instead of the shortcode. It loads the screenshots as Image blocks inside a Gallery instead of the React screenshot UI. This removes the React dependency from the page, so it's no longer necessary to load all of that JS, saving about 140KB.
I'm not sure this is merge-able as-is since it does look very different than the current UI, but I saw the ticket and wanted to give it a shot.
Fixes https://meta.trac.wordpress.org/ticket/8083
Notes
[wporg-plugins-screenshots]code can be removed before merging (I don't think they're used anywhere else).Screenshots
This uses the default layout of a 3-column gallery, which is pretty divergent from the current slideshow style of images, especially when they have captions. As for captions, they're visible on all images now, but they do not show up in the lightbox (see WordPress/gutenberg#60469).