Block wrapper (<center>) merged into an inline synthetic paragraph loses its line box and widens layout-table cells

Aperta
#7,051 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
html, php, wordpress
Ambito
backend, web-dev

Direzione di ricerca

Start by tracing the HTML conversion that merges the <center> wrapper with its inline child and assigns the synthetic paragraph classes; the issue does not name the responsible files or tests. Use the reduced table fixture to compare the wrapped case with the bare-link case, then run php tests/parity/run.php. Done means the wrapped label keeps a block box and the following image starts on a new line, while the bare-link case stays inline and the parity check passes.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

A block-level wrapper around only inline content (here <center><font><a>label</a></font></center>) is merged away during conversion. The resulting core/paragraph takes the inline <font>/<a> as its source element, so it gets blocks-engine-synthetic-paragraph without blocks-engine-source-box-paragraph. The engine rule :where(p.blocks-engine-synthetic-paragraph:not(.blocks-engine-source-box-paragraph)){display:inline} then makes it inline.

In the source, the <center> is a block box, so whatever follows starts on a new line. In WordPress the label's last word shares a line with the following inline content. In layout-table cells, that content is the linked image, whose figure is display:contents with an inline img. The cell's min-content width becomes last word + image, and the auto table widens past its authored width.

Real case: physics.uci.edu /~tritz/ (Blocks Engine trunk 925eabd2b4b).

Sidebar width Page scrollWidth at 1440 Page scrollWidth at 390
Source 165px 1440 (no horizontal scroll) 925
WordPress 260px ("Photosynthesis" and the 140px image on one line) 1541 1026

Reduced repro

<table border="0" cellspacing="0" cellpadding="0" width="100%"><tbody><tr valign="top"><td width="160"><table border="0" cellspacing="0" cellpadding="10" width="160" bgcolor="#000000"><tbody><tr><td align="center"><center><font color="#FFFFCC"><a href="/psu.html" style="color:#FFFFCC;text-decoration:none">Quantum Biology of Photosynthesis</a></font></center><a href="/psu.html"><img src="/media/psu.jpg" alt="Quantum Biology" border="0" height="128" width="140"></a></td></tr><tr><td align="center"><a href="/mag.html">Magnetic Sense</a></td></tr></tbody></table></td><td><h1>Physical Biology</h1><p>The biological sciences currently undergo a revolution comparable to the revolution in physics in the first half of the 20th century.</p><p>Our group focuses on relating the structure of protein assemblies to their function.</p></td></tr></tbody></table>

Output:

<p class="blocks-engine-synthetic-paragraph blocks-engine-synthetic-anchor-undecorated"><mark …><a href="/psu.html">…

This is followed by <figure class="wp-block-image … blocks-engine-synthetic-image-figure-inline">. The paragraph has no source-box class, so it renders display:inline.

Expected

  • A paragraph whose content came from a block-level source wrapper (center, div, p, and so on) that was merged into its only inline child keeps a block box. Mark it blocks-engine-source-box-paragraph, or otherwise emit the line break the wrapper produced.
  • Content following it in the same cell (the linked image) starts on its own line, as in the source.
  • Truly inline sources (loose text, or a bare <a> or <font> directly in the cell) keep the current inline behaviour.

Verification

  • Unit or contract test with the fixture above: the label paragraph carries blocks-engine-source-box-paragraph, or renders as a block. A sibling case without <center> (bare <a> plus <img> in the cell) still gets the inline synthetic paragraph.
  • Parity: php tests/parity/run.php shows no regressions.
  • Rendered check: on the physics.uci.edu import, /~tritz/ has scrollWidth 1440 at a 1440px viewport, and the sidebar is about 165px wide.
Lingua principale
PHP
Stelle
31
Fork
7
Merge medio
3h 40m
PR unite (30g)
813

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Automattic/blocks-engine

Tutte le issue di Automattic/blocks-engine

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.