Merged nav+ul core/navigation root takes the list's width:100% over the source nav's width

Abierto
#5,461 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
64/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
php, wordpress
Área
frontend

Línea de trabajo

Start by locating the transformer that merges the source cnave and cule into a ccore/navigatione root, then find the existing transformer tests. Reproduce the reduced page and inspect how its nav and list width rules are projected onto the merged root. Done means a test shows a 424px root beside the logo and item widths matching the source within 1px.

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

Descripción

Finding

When a source <nav> and its <ul> merge into one core/navigation root, the list's author classes are copied onto that root. A list rule such as .menu{width:100%} then competes with the source nav's own nav{width:424px} on the same element, and wins on specificity. The navigation fills its whole flex parent, wraps below the logo, and every flex:1 1 auto item stretches.

This came from a Wix site import: the desktop header grew from 77px to 149px in the reduced case, and from 131px to 255px on the real site (with #5422).

Reduced page

<!doctype html><html><head><meta charset="utf-8"><title>index</title><style>
body{margin:0;font:15px sans-serif;background:#f4f3ef}
header{display:flex;align-items:center;gap:40px;padding:20px 280px}
.logo{font-size:28px;color:#555}
nav{display:flex;width:424px}
.menu{display:flex;flex-wrap:wrap;gap:6px;margin:0;padding:0;list-style:none;width:100%}
.item{flex:1 1 auto}
.link{flex:1;display:block;text-decoration:none;color:#333;padding:10px 8px;text-align:center}
.link.current{background:#e0dfdb}
</style></head><body>
<header><div class="logo">travelism</div><nav aria-label="Site"><ul class="menu">
<li class="item"><div><a class="link current" href="index.html">Home</a></div></li>
<li class="item"><div><a class="link" href="a.html">About</a></div></li>
<li class="item"><div><a class="link" href="b.html">Reiseziele</a></div></li>
<li class="item"><div><a class="link" href="c.html">Wanderful</a></div></li>
</ul></nav></header>
<main><p>Page text.</p></main>
</body></html>
source imported (SSI 1.33.512 / BE 0.45.448)
nav width 424 (nav) 880 (nav.wp-block-navigation.menu)
nav top 20 (beside logo) 92 (wrapped below logo)
"Home" item 87×37 201×37
header height 77 149

Width rules that match the generated <nav class="wp-block-navigation … blocks-engine-list-navigation menu">:

:where(.blocks-engine-source-nav-…-0):not(be-t-0) { width:424px }   /* source nav, specificity 0,0,1 */
.menu { width:100% }                                                 /* source ul, specificity 0,1,0, now on the same element */

Expected

The merged root renders at the source nav's width (424px here), and the items match their source widths. A list rule should only win where it also won in the source. One way to get there: project the list's box declarations onto the root only where the source nav did not size that axis. Another: give the merged root the list's rule under a selector that cannot outrank the nav's projection.

Related: #4945 (the responsive root inheriting the list's classes; closed) and #1482.

Acceptance

  • In the reduced page, the core/navigation root is 424px wide and sits beside the logo, and each item width matches its source width ±1px.
  • A test covers the transformer output for the reduced page.

AI disclosure: found and reduced by Claude (Pi via Roadie) during a Data Liberation import loop on a Wix site; reviewed by @chubes4.

Lenguaje dominante
PHP
Estrellas
28
Forks
5
Merge medio
2 h 59 min
PR fusionados (30 d)
942

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.