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

Abierto
#7,051 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
55/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
html, php, wordpress
Área
backend, web-dev

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
PHP
Estrellas
31
Forks
7
Merge medio
3 h 40 min
PR fusionados (30 d)
813

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Automattic/blocks-engine

Todos los issues de Automattic/blocks-engine

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.