Make WordPress Core

Opened 6 weeks ago

Last modified 39 hours ago

#66188 accepted defect (bug)

Add vertical margin between Save Draft and Preview buttons in Classic Editor

Reported by: Emielb Owned by: joedolson
Priority: normal Milestone: 7.2
Component: Editor Version: 7.1.2
Severity: normal Keywords: admin-reskin has-patch
Cc: Focuses:

Description

When using a translated version of WordPress (e.g., fr_FR) with the Classic Editor, the translated strings for the "Save Draft" and "Preview" buttons are longer than in English. This causes the buttons to wrap onto two lines within the #minor-publishing-actions container.

Due to recent CSS changes applied to buttons, there is currently no vertical margin between them when they stack, causing a visual overlap.

Steps to reproduce

  1. Install and activate the Classic Editor plugin.
  2. Set the Site Language to French (fr_FR) to ensure the button text is long enough to wrap.
  3. Navigate to Articles → Ajouter un article.
  4. Observe the "Publier" metabox (specifically the "Enregistrer le brouillon" and "Prévisualiser" buttons).
  5. Notice that the buttons are stacked and touch each other without any vertical spacing.

Expected result

There should be a consistent vertical gap between the buttons when they are forced onto multiple lines.

Possible solution

A simple CSS adjustment could be added to handle the spacing when items wrap. For example, applying a bottom margin to the first button's container or utilizing flexbox gap on the parent #minor-publishing-actions:

#minor-publishing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
}

/* Fallback/alternative */
#save-post {
    margin-bottom: 8px;
}

Attachments (2)

publier-nogap-fr_FR.png​ (22.7 KB ) - added by Emielb 6 weeks ago.
Missing vertical margin between Save Draft and Preview buttons when stacked in fr_FR
01 spinner.png​ (33.5 KB ) - added by afercia 6 weeks ago.

Download all attachments as: .zip

Change History (11)

@Emielb
6 weeks ago

Missing vertical margin between Save Draft and Preview buttons when stacked in fr_FR

#1 @joedolson
6 weeks ago

  • Milestone Awaiting Review → 7.2
  • Owner set to joedolson
  • Status new → accepted

#2 @audrasjb
6 weeks ago

Thanks for opening the ticket @Emielb and welcome to WordPress Core Trac.

I agree that we need at least some margin between the two buttons when they're stacked. I don't think we necessarily need to have them aligned on the left or so, though. The priority is to address the margin issue.

I was about to take ownership on this one as it was reported from someone in the French community after some useful discussion on our Slack team, but you beat me @joedolson :)

Well, let's fix this in 7.2.

#3 @joedolson
6 weeks ago

Feel free to take it over, @audrasjb, if you wish!

#4 @afercia
6 weeks ago

For any CSS change on this UI, reminder that there is a spinner there that should be taken into account. See screenshot.

#5 @sainathpoojary
6 weeks ago

I reproduced the issue. Adding a bottom margin to Save Draft fixes the missing spacing when the buttons wrap.

https://hgeisrmuxslkxkhhewgj.supabase.co/storage/v1/object/public/uploads/Group%201.png

Margin addition change is:

#save-post {
        float: left;
        margin-bottom: 8px;
}

The tradeoff is that this also adds vertical space when both buttons fit on the same row.

Before:
https://hgeisrmuxslkxkhhewgj.supabase.co/storage/v1/object/public/uploads/Screenshot%202026-09-28%20at%205.22.20%20PM.png

After:
https://hgeisrmuxslkxkhhewgj.supabase.co/storage/v1/object/public/uploads/Screenshot%202026-09-28%20at%205.20.26%20PM.png

Should we proceed with this simpler margin approach for now, or should we look into converting the entire container's layout to use flexbox so we can utilize the gap property instead?

This ticket was mentioned in ​PR #13807 on ​WordPress/wordpress-develop by ​@therssoftware.


6 weeks ago
#6

  • Keywords has-patch added

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

Description

In the Classic Editor's "Publish" meta box (#minor-publishing-actions), the "Save Draft" and "Preview" buttons wrap onto two lines when button labels are translated into longer strings in non-English locales (e.g. French fr_FR or German de_DE), or on narrow sidebar viewports. Previously, when wrapping occurred, the buttons collided vertically with zero margin between them.

This PR updates #minor-publishing-actions to use flexbox layout, consistent with the existing modernization in #major-publishing-actions:

  1. Flexbox with wrapping and gap: Sets #minor-publishing-actions to display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;. This ensures a clean 8px vertical separation whenever the buttons wrap to multiple lines.
  2. Hide legacy clearfix: Sets #minor-publishing-actions .clear { display: none; } as float clearing is no longer required with flex layout.
  3. Centered spinner beside button: Sets #save-action to display: flex; align-items: center; and removes the float on its child .spinner (float: none; margin-top: 0; margin-bottom: 0;), keeping the loading spinner vertically centered beside the button without float wrapping issues.
  4. End alignment for Preview: Sets #preview-action to margin-left: auto; text-align: right; (which Grunt RTL build automatically mirrors to margin-right: auto; text-align: left;), preserving end-edge alignment both when side-by-side and when wrapped.
  5. Clean up obsolete overrides: Removes #save-action .spinner float override in edit.css.

Testing Instructions

  1. In WordPress admin, install and activate the Classic Editor plugin (or test any post edit screen with the Classic Editor Publish meta box).
  2. Switch site language to French (fr_FR) or German (de_DE), or inspect and artificially lengthen the "Save Draft" button text (e.g. "Enregistrer le brouillon").
  3. Narrow the Publish meta box sidebar width until the "Save Draft" and "Preview" buttons wrap onto separate lines.
  4. Verify that:
    • There is an 8px vertical gap between the top button and bottom button (no collision).
    • The Preview button aligns cleanly to the right edge (LTR) or left edge (RTL).
    • Clicking "Save Draft" displays the spinner vertically centered beside the button.
  5. Test in RTL mode (e.g., Arabic or Hebrew) to confirm proper mirroring.

Props therssoftware.

---
AI Disclosure: In accordance with the WordPress AI policy, I disclose that generative AI (Google Antigravity) was used in drafting the CSS changes and testing across LTR/RTL locales, and all changes were manually reviewed and verified.

#7 @therssoftware
6 weeks ago

I have opened a GitHub PR to resolve this using Flexbox: ​https://github.com/WordPress/wordpress-develop/pull/YOUR_PR_NUMBER

Instead of adding a permanent margin-bottom, this modernizes #minor-publishing-actions with display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between;:

  • Avoids the tradeoff mentioned in comment:5—when both buttons fit on a single row, no extra bottom spacing is added. Spacing only applies when wrapped.
  • Centers #save-action and its .spinner via flexbox, keeping the spinner vertically aligned without float issues.
  • Sets #preview-action with margin-left: auto; text-align: right; (and mirrors for RTL).
  • Hides the legacy .clear element and cleans up obsolete float overrides in edit.css.

Verified with Grunt RTL build across LTR and RTL locales.

*AI Disclosure: Prepared with generative AI assistance (Google Antigravity) and manually tested and verified.*

This ticket was mentioned in ​Slack in #core by im3dabasia1. ​View the logs.


39 hours ago

#9 @im3dabasia1
39 hours ago

As per today’s 7.2 bug scrub:

Thanks for the issue! PR is open and awaits review, @joedolson, would you be able to review it when you have a moment?

Note: See TracTickets for help on using tickets.