Fix plugin-card button overlap on Add Plugins screen (#64686)#12376
Fix plugin-card button overlap on Add Plugins screen (#64686)#12376369work wants to merge 1 commit into
Conversation
…een. Replaces the position:absolute based layout of .plugin-card-top with a flexbox + container query based one. See #64686 for background.
|
Hi there! 👋 Thank you for your contribution to WordPress! 💖 It looks like this is your first pull request to No one monitors this repository for new pull requests. Pull requests must be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. Pull requests are never merged on GitHub. The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making. More information about how GitHub pull requests can be used to contribute to WordPress can be found in the Core Handbook. Please include automated tests. Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the Automated Testing page in the handbook. If you have not had a chance, please review the Contribute with Code page in the WordPress Core Handbook. The Developer Hub also documents the various coding standards that are followed:
Thank you, |
|
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. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
There was a problem hiding this comment.
Pull request overview
This PR addresses button overlap in the Plugin Install “Add Plugins” screen by refactoring the .plugin-card-top layout from an absolute-positioning approach to a flexbox layout driven by container queries. This aligns the internal card layout with the card’s rendered width (rather than viewport width), preventing breakpoint mismatches that previously caused overlaps.
Changes:
- Adds
container-type: inline-sizeto.plugin-cardto enable size-based container queries. - Replaces
.plugin-card-top’s positioning-based layout with a wrapping flex layout (icon/title, actions, description). - Updates action button list styling to switch between inline and stacked layouts via
@container (min-width: 600px).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This is certainly going in a better direction - I think using containers to handle the width is a good idea. However, this style change introduces a significant visual difference that leaves a large amount of empty white space that I don't think is desirable. I think it's going to require some structural changes in order to be feasible. As I see it, the region with the icon, title, and action buttons needs to be a grid/flex with an order of icon > heading/description > actions. It won't be trivial to achieve the current or similar layout while also ensuring that the |
Summary
This patch fixes the plugin-card button overlap reported in #64686 by
replacing the absolute-positioning-based layout of
.plugin-card-topwith a flexbox + container query based one, following the direction
agreed in comment:29 (joedolson) and comment:30 (wildworks): no
position: absolute, no legacy fixed-offset CSS, and a layout thatdoesn't depend on button label length.
Only
src/wp-admin/css/list-tables.cssis touched. No PHP/markupchanges are required.
Root cause
The overlap wasn't a single bug — it was two independent, viewport-based
breakpoint systems drifting out of sync:
#the-list) decides how many.plugin-cards fitper row (1 column below 782px, 2 columns from 783px, 3 columns from
1600px, 4 columns from 2300px).
.plugin-card-top(icon / title / description /action buttons) previously decided its own layout using viewport
width via
@media, not the actual rendered width of the card.Because a card's real width depends on both the viewport width and the
current column count, a
@mediarule keyed to viewport width can'treliably predict how much space is actually available inside a card.
A card in 3-column mode at a wide viewport can be narrower than a card
in 2-column mode at a medium viewport, yet a viewport-based rule treats
them identically. This mismatch is what produced the reported overlaps
at 320px, 481–756px, and again at 1600px+.
Why container queries instead of viewport media queries
container-type: inline-sizeis added to.plugin-card, and theinternal layout responds to the card's own rendered width via
@container, not the viewport. This removes the dependency on twounrelated breakpoint systems entirely — the inner layout now always
has an accurate picture of its own available space, regardless of
column count or viewport size.
Browser support: container size queries are supported by all browsers
in Core's official browser support matrix
(last 2 versions of Chrome/Firefox/Safari/Edge/Opera/iOS), so no
fallback is required.
Why 600px as the breakpoint
The action-buttons column only shares a row with the icon+title when
there's enough width for all three to coexist without cramping:
Summing these gives roughly 550px as the point where things start to
fit at all, with no margin for longer translations or larger font
settings. 600px was chosen to give a small buffer above that minimum
so the side-by-side layout only activates when there's genuinely
enough room, consistent with the "don't depend on button text length"
principle from comment:29/30.
Icon/title ordering
The icon remains inside the existing
<a class="open-plugin-details-modal">(no markup change).
.plugin-card .name h3 ais made a flex container;the title text becomes an anonymous flex item and
.plugin-iconisplaced before it visually via
order: -1, keeping the icon clickableas part of the details link and preserving the existing DOM order.
Testing
Verified visually across 320, 375, 540, 768, 820, 1024, 1200, 1440,
1574, and 1920px viewport widths on the "Add Plugins" (bundled/beta),
single-column, and multi-column (2/3-col) card grids. In all cases:
(wide cards) the icon+title block, with no cards falling into an
inconsistent in-between state
Trac ticket: https://core.trac.wordpress.org/ticket/64686
Use of AI Tools
AI assistance: Yes
Tool(s): Claude (Anthropic)
Model(s): Claude
Used for: Root-cause analysis of the layout bug, CSS implementation (flexbox + container query refactor), and drafting this PR/Trac description. All changes were tested and verified across multiple viewport widths (320–1920px) by me before submission.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.