Skip to content

Administration: Fix the update button layout in At a Glance - #12715

Open
itzmekhokan wants to merge 1 commit into
WordPress:trunkfrom
itzmekhokan:fix/65733-at-a-glance-update-button-layout
Open

Administration: Fix the update button layout in At a Glance#12715
itzmekhokan wants to merge 1 commit into
WordPress:trunkfrom
itzmekhokan:fix/65733-at-a-glance-update-button-layout

Conversation

@itzmekhokan

Copy link
Copy Markdown

Lays out the 'At a Glance' version message with flexbox so the 'Update to n.n.n' button stays inside the widget and its text baseline aligns with the version text.

What the problem was:

  • The button was floated out of the version message line box and pulled up 5px, a hack from [31812] that assumed a ~30px tall button.
  • The admin reskin set .wp-core-ui .button to min-height: 40px, so the float no longer fits the ~18px line box it vacated. It eats the widget's 12px bottom padding and overflows the postbox border by 3px.
  • The button text baseline does not line up with the version text baseline.

What the fix does:

  • Makes #wp-version-message a flex container with align-items: baseline, so the paragraph contains the button and both baselines align.
  • order: 1 and margin-left: auto keep the button visually last and flush right, replacing float: right.
  • flex: 1 on #wp-version keeps the button on the first line of text, matching the previous float layout instead of pushing it onto its own line.
  • flex-wrap: wrap preserves the intent of [31812] for long strings, e.g. long translated button labels in narrow widgets.

Approach and why:

  • CSS only, scoped to the existing selector. No markup, PHP, or hook changes, so there is nothing for plugins to have bound to. Content added via the update_right_now_text filter stays inside #wp-version and is unaffected.
  • Flexbox is the minimum tool that fixes both reported issues at once: a float is out of flow, so no float-based fix can align baselines.
  • gap in a flex context already has precedent in this file (.community-events-form).
  • RTL was verified against the generated dashboard-rtl.css: margin-left: auto flips to margin-right: auto and every other declaration is direction-agnostic.
  • When no update is available the rendered geometry is identical to trunk (box height, paragraph height and position, text start all unchanged).

Trac ticket: https://core.trac.wordpress.org/ticket/65733

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Ticket analysis, verified tests and writing PR description. All changes were reviewed and validated by me


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.

The 'Update to n.n.n' button was floated out of the version message line
box and nudged up by five pixels. Since the admin reskin increased the
button height to 40 pixels, the float no longer fitted the space it left
behind and overflowed the bottom of the 'At a Glance' widget.

Lay the version message out with flexbox instead. The button is now part
of the paragraph's flow, so the widget grows to contain it, and its text
baseline is aligned with the version text.

Fixes #65733.
Copilot AI review requested due to automatic review settings July 27, 2026 14:24
@github-actions

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 khokansardar.

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

@github-actions

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 updates the CSS for the “At a Glance” dashboard widget’s WordPress version message to use a flexbox layout so the core update button stays contained within the widget and can align to the version text baseline, replacing the prior float/relative-position hack.

Changes:

  • Make #dashboard_right_now #wp-version-message a flex container with wrapping and baseline alignment.
  • Make #dashboard_right_now #wp-version flex to keep the update button on the same line when possible.
  • Replace the update button’s float/offset positioning with flex ordering and auto margin alignment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +727 to 742
#dashboard_right_now #wp-version-message {
display: flex;
flex-wrap: wrap;
align-items: baseline;
gap: 5px;
}

#dashboard_right_now #wp-version {
flex: 1;
}

#dashboard_right_now #wp-version-message .button {
float: right;
position: relative;
top: -5px;
margin-left: 5px;
/* The button is first in the markup, but is displayed after the version text. */
order: 1;
margin-left: auto;
}
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.

2 participants