Make WordPress Core

Opened 2 weeks ago

Closed 2 weeks ago

#66382 closed defect (bug) (fixed)

Left/right aligned blocks have the wrong margin side in RTL

Reported by: im3dabasia1 Owned by: peterwilsoncc
Priority: normal Milestone: 7.2
Component: Editor Version:
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses:

Description (last modified by im3dabasia1)

The .alignleft / .alignright layout rules combine a physical float with logical margin-inline-* margins. In RTL the 2em gap lands against the container edge instead of between the block and the wrapping text.

Switching to margin-left / margin-right fixes this. LTR output is unchanged.

Steps to reproduce:

  1. Set the site language to Arabic or Hebrew.
  2. Add an Image block, align it Left, and set its width to around 400px.
  3. Add a long Paragraph after it.
  4. On the front end, the gap is at the container edge instead of between the image and the text.

Gutenberg issue: ​https://github.com/WordPress/gutenberg/issues/40501
Gutenberg PR: ​https://github.com/WordPress/gutenberg/pull/83520

Change History (5)

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


2 weeks ago
#1

  • Keywords has-unit-tests added

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

Backport of WordPress/gutenberg#83520.

  • The .alignleft and .alignright layout rules used logical margin-inline-* alongside a physical float.
  • In RTL the 2em gap ended up on the wrong side of the block.
  • This switches them to margin-left / margin-right.
  • LTR output is unchanged.

Only the PHP is ported here. The JS and SCSS changes come through the package sync.

#2 @im3dabasia1
2 weeks ago

  • Component General → Editor

#3 @im3dabasia1
2 weeks ago

  • Description modified (diff)

​@peterwilsoncc commented on ​PR #14878:


2 weeks ago
#4

The E2E SCRIPT_+DEBUG enabled test has failed a couple of times, reviewing the errors each time it is due to problems connecting with the WP.org API so I will ignore those and external/networking errors.

#5 @peterwilsoncc
2 weeks ago

  • Owner set to peterwilsoncc
  • Resolution → fixed
  • Status new → closed

In 64998:

Editor: Use physical margins on .alignleft / .alignright.

Switches the .alignleft / .alignright layout rules from margin-inline-start / margin-inline-end to margin-left / margin-right. Values are unchanged. .aligncenter is untouched.

Previously the float properties were using physical directions with logical margins, resulting in layout errors in right-to-left languages.

Props im3dabasia1, wildworks, ndiego, isabel_brison, joen, azragh.
Fixes #66382.

Note: See TracTickets for help on using tickets.