Skip to content

Fix plugin-card button overlap on Add Plugins screen (#64686)#12376

Open
369work wants to merge 1 commit into
WordPress:trunkfrom
369work:fix/64686-plugin-card-overlap
Open

Fix plugin-card button overlap on Add Plugins screen (#64686)#12376
369work wants to merge 1 commit into
WordPress:trunkfrom
369work:fix/64686-plugin-card-overlap

Conversation

@369work

@369work 369work commented Jul 1, 2026

Copy link
Copy Markdown

Summary

This patch fixes the plugin-card button overlap reported in #64686 by
replacing the absolute-positioning-based layout of .plugin-card-top
with 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 that
doesn't depend on button label length.

Only src/wp-admin/css/list-tables.css is touched. No PHP/markup
changes are required.

Root cause

The overlap wasn't a single bug — it was two independent, viewport-based
breakpoint systems drifting out of sync:

  1. The outer grid (#the-list) decides how many .plugin-cards fit
    per row (1 column below 782px, 2 columns from 783px, 3 columns from
    1600px, 4 columns from 2300px).
  2. The inner layout of .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 @media rule keyed to viewport width can't
reliably 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-size is added to .plugin-card, and the
internal layout responds to the card's own rendered width via
@container, not the viewport. This removes the dependency on two
unrelated 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:

  • Card padding: 32px (16px × 2)
  • Icon: 128px (fixed)
  • Icon–title gap: 20px
  • Title (minimum comfortably readable width): ~150px
  • Title–button gap: ~20px
  • Action button column (accounting for longer translated labels): ~180–200px

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 a is made a flex container;
the title text becomes an anonymous flex item and .plugin-icon is
placed before it visually via order: -1, keeping the icon clickable
as 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:

  • Icon and title stay aligned regardless of title length
  • Action buttons consistently sit below (narrow cards) or beside
    (wide cards) the icon+title block, with no cards falling into an
    inconsistent in-between state
  • No overlapping elements at any tested width

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.

…een.

Replaces the position:absolute based layout of .plugin-card-top with a flexbox + container query based one. See #64686 for background.
Copilot AI review requested due to automatic review settings July 1, 2026 06:34
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

Hi there! 👋

Thank you for your contribution to WordPress! 💖

It looks like this is your first pull request to wordpress-develop. Here are a few things to be aware of that may help you out!

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 WordPress Project

@github-actions

github-actions Bot commented Jul 1, 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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props 369work, joedolson.

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

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Copilot AI left a comment

Copy link
Copy Markdown

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 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-size to .plugin-card to 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.

@joedolson

Copy link
Copy Markdown
Contributor

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 h3 is the first item in the card and the icon is clickable, but that's what needs to happen. It might mean needing to remove the icon from the link and give it a scripted event to trigger the heading's link, but have the image itself have aria-hidden. The focus target would change shape, but the ability to trigger the link would be unchanged for keyboard users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants