Footer layout with a form and two images becomes one raw-HTML "Custom Gallery" block (generated_component_non_native_items)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
調査の方向性
Start with GeneratedComponentLowering.php and SubtreeClassifier.php, especially nativeOrGeneratedBlock(), isEntirelyNativeComponent(), repeatableChildCount(), and the media gallery signal. Reproduce through ArtifactCompiler::compileFragment() with the reduced page described in the issue, then inspect the generated blocks and diagnostics. Done means the form remains available to provider materialization, native siblings stay native, and the reduced footer produces no generated gallery or collection raw HTML block; add the described regression assertions and check the related fixtures.
索引モデルが issue の本文から書いたものです。
説明
Problem
A site footer laid out as two rows in a column container (a link row, then a row holding a newsletter <form> and two payment-method <img> icons) is turned into one generated raw-HTML block, <ns>/gallery-<sha256> ("Custom Gallery", block.json blocksEngine.editingSurface: raw_html). It is not lowered to core/group + core/paragraph/core/image and the form path. The diagnostic reason is generated_component_non_native_items. On the real import, this is the entire site footer in parts/footer.html (logo, social icons, <hr>, "Stay in the Loop" form, reCAPTCHA notice, 8 payment icons, copyright). The owner can only edit it as an HTML textarea. Because the form is frozen inside the raw HTML string, the form provider never sees it, so no Jetpack form is materialized either.
Two decisions combine to cause this:
- The candidate gate misreads a layout as a repeated gallery.
GeneratedComponentCandidates::collectGeneratedComponentCandidates()marks thediv.container.colonce it is at leastGENERATED_COMPONENT_MIN_SOURCE_DEPTH(14) levels below<body>, has repeated direct-child tags, andFallbackEmitter::isRepeatableContentComponent()is true.SubtreeClassifierscores the container ascustom_block(score 4 vscustom_application2, confidence 0.78), from two signals:repeatable_children = 2: the two layout rows share the classcell rowand both "carry text" (a link label in one, the button label in the other). They are not repeated content items.media_gallery = true: any 2<img>anywhere in the subtree count as a gallery, here two 24 px payment icons. This signal also gives the generated block itsgallery-stem and the "Custom Gallery" title.
- One non-native item freezes the whole container.
GeneratedComponentLowering::nativeOrGeneratedBlock()does tryauthorLayoutBlockFromElement(). Inside it, the<form>lowers to aform_requires_runtimepreserved runtime island (core/htmlplus a fallback entry), which at shallow depth is later materialized asjetpack/contact-form. Because$nativeFallbacksis not empty andisEntirelyNativeComponent()rejectscore/html, the native result is thrown away and the entire container, including its native-expressible siblings, goes toFallbackEmitter::maybeGenerateCustomBlock(..., preserveRoot: true, confirmedComponent: true).
Seen on a Square Online site import (dandiandidesigns.com; Studio 2.1.0-dev276 / Static Site Importer 1.33.507 / Data Liberation Agent 0.33.201). Also reproduces on Blocks Engine trunk 316ce5d41c (php-transformer 0.45.436) through ArtifactCompiler::compileFragment(). Similar gallery-* raw-HTML blocks appear in the page content of the same site.
Reduced page
index.html, plus a media/ folder holding any two small SVG/PNG files named visa.svg and mastercard.svg:
<!DOCTYPE html>
<html lang="en"><head><meta charset="utf-8"><title>Acme</title>
<style>
.row{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.col{display:flex;flex-direction:column;gap:16px}
.pay{width:38px;height:24px}
</style></head>
<body>
<div class="wrap"><div class="wrap"><div class="wrap"><div class="wrap"><div class="wrap"><div class="wrap">
<main><h1>Acme</h1><p>Welcome to Acme.</p></main>
<footer class="site-footer"><div class="wrap"><div class="wrap"><div class="wrap"><div class="wrap"><div class="wrap"><div class="wrap">
<div class="container col">
<div class="cell row"><a href="mailto:[email protected]">Email</a></div>
<div class="cell row">
<form action="/subscribe" method="post"><input type="email" name="email" placeholder="Email"> <button type="submit">Sign Up</button></form>
<img class="pay" src="media/visa.svg" alt="Visa"> <img class="pay" src="media/mastercard.svg" alt="Mastercard">
</div>
</div>
</div></div></div></div></div></div></footer>
</div></div></div></div></div></div>
</body></html>
(The 12 .wrap divs only put .container.col at source depth 14, which matches the real Square Online DOM: body > div.app-container > … > footer > … > div.w-container.col.)
Steps
studio create --from ./reduced --path ./site --name footer-gallery --skip-browser
(reduced/ holds index.html + media/.) Or call (new ArtifactCompiler())->compileFragment(file_get_contents('reduced/index.html'), 'index.html') on trunk.
Observed
parts/footer.htmliscore/group(footer) > core/group > <ns>/gallery-a9a3a25f…and nothing else. The block'scontentattribute is the whole.container.colsubtree as an HTML string, including the<form>and both<img>tags.ssi-runtime/blocks/gallery-a9a3a25f…/block.json:"title": "Custom Gallery","blocksEngine": {"editingSurface": "raw_html"}.- Diagnostics:
preserved_runtime_island / form_requires_runtime, thengenerated_component_non_native_items("Repeated content retained as generated raw HTML"), thenraw_html_companion_block / generated_document_contains_raw_html_companionat selectordiv.container.col.raw_html_companion_block_count: 1.quality_pass: true, so the gate does not flag it. SubtreeClassifier::classify(div.container.col):bucket=custom_block, confidence=0.78, repeatable_children=2, media_gallery=true, form_controls=1, scores={custom_block:4, custom_application:2}.
Controls, each from the same page with one change (Studio import + classifier):
| Change | Classifier | Result |
|---|---|---|
| none (reduced page) | custom_block 4 / app 2 → candidate | 1 × gallery-<sha> raw HTML |
<form> replaced by <span>Sign up below</span> |
custom_block 4 / 0 → candidate (same as above) | native: group ×5, image ×2, paragraph ×2 |
<form> removed |
repeatable_children=1 → not a candidate |
native: gallery + image ×2 |
second <img> removed |
media_gallery=false, tie 2/2 → unknown |
native groups + image + form → jetpack/contact-form, jetpack/field-email |
Full-footer bisection on the real capture showed the same pattern. Removing the social-icon row, the form, or the payment-icon row each gave a native footer. Removing only the logo still gave the raw-HTML gallery. In the original markup, the social <svg><title>Email</title><use …> icons are what make the first row "carry text".
Expected
- A container whose children are a few dissimilar layout rows is not a "repeatable" component. A row of small payment or icon images is not a
media_gallerythat turns a footer into a "Custom Gallery". - When a candidate's native lowering contains a runtime island (here the form), the island stays a bounded island (
core/html/ provider-materialized form →jetpack/contact-form). Its native siblings (core/group,core/paragraph,core/image,core/separator, social links) stay native, rather than the whole container becoming one raw-HTML block. - For the reduced page:
parts/footer.htmlcontainscore/group>core/paragraph/link + the form (Jetpack form after provider materialization) + 2 ×core/image, with nogallery-*/collection-*raw_html block.
Likely owner
php-transformer/src/HtmlToBlocks/Elements/GeneratedComponentLowering.php,nativeOrGeneratedBlock()/isEntirelyNativeComponent(): this is all-or-nothing. A singleform_requires_runtimeisland (core/html+$nativeFallbacksentry) discards the native lowering of the whole component.php-transformer/src/HtmlToBlocks/Classification/SubtreeClassifier.php:repeatableChildCount()counts two layout rows with a shared class as repeated items, andmedia_galleryis "≥ 2img|picture|figure|videoanywhere in the subtree". AlsoFallbackEmitter::isRepeatableContentComponent()(thresholdrepeatable_children >= 2) andSupport/GeneratedComponentCandidates.php.- Related: #4153 (depth-gated candidates freeze native-expressible repeats; open), #4232 and #4357 (earlier causes of
generated_component_non_native_itemsfreezing whole lists; closed).
Measurement
- Regression test through
ArtifactCompiler::compileFragment()with the reduced page: assert no block whose name matches/\/(gallery|collection)-[0-9a-f]{64}$/, assert acore/imageper payment icon, and assert the form is still exposed to the form provider (aform_requires_runtimeisland or form metadata, not text inside a generated block'scontent). The test fails on trunk316ce5d41cand passes with the fix. - Studio import of the reduced page:
raw_html_companion_block_count: 0and nogenerated_component_non_native_itemsdiagnostic. - The
<form>→<span>control keeps lowering natively, and the existing #4153/#4357 fixtures keep their current results.
Secondary findings (separate causes of the visual losses on the real footer)
These are not caused by the classification above, but they are why the frozen footer also renders badly. Both live in the companion-block render boundary that Static Site Importer generates (includes/class-static-site-importer-companion-plugin.php → ssi-runtime/blocks/*/render.php), so they probably belong in Automattic/static-site-importer:
- Two empty comments
<!---->(Vue placeholders) corrupt the rest of the block.render.phpcallswp_kses(). Itspre_ksesfilterwp_pre_kses_block_attributes()→filter_block_content()runspreg_replace_callback('%<!--(.*?)--->%', …). That regex spans from the first<!---->to the--->of the next one, soa <!----> b <!----> cbecomesa <!----> b <!--> c. KSES then outputsa b <!--> c-->, and everything after the second empty comment becomes comment text. Measured on the real footer block: 16<!---->in thecontentattribute became 7<!-->comment openers inrender_block()output. They hide 7 of 8 payment icons, the reCAPTCHA notice, and several closing</div>tags, which collapses the form layout (Sign Up wraps under a narrow input).wp_kses_post('a <!----> b <!----> c')alone reproduces it on WordPress 7.1.4. Stripping HTML comments from generatedcontentbefore the KSES boundary would avoid it. - Sprite icons lose their
<use>. The render boundary's SVG pass keepshref/xlink:hrefonly for fragments whoseidis inside the same<svg>.<use xlink:href="#email-icon">points at a page-level<symbol>sprite, so the<use>is removed and the Email/Facebook/Instagram icons render as empty 24×24 boxes (the frontend also has no#email-iconsymbol). Related: #4984 and #4797 (sprite sheets).
Reduced and filed by Claude (Anthropic) via the Franklin import-loop orchestrator; reduction verified with studio create --from.
- 主要言語
- PHP
- スター
- 28
- フォーク
- 5
- 平均マージ
- 2時間 59分
- マージ済み PR(30日)
- 942
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Automattic/blocks-engine のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
Automattic/blocks-engine#6318 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Automattic/blocks-engine#4943 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Automattic/blocks-engine#4942 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Automattic/blocks-engine#4921 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
Automattic/blocks-engine#775 ·
メンテナーはふだん 1 日以内に返信
Automattic/blocks-engine の issue をすべて見る
似ている issue
-
15.0
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
PHP 8.6: is_integer() deprecation in Decorator\Style対応中かも @ElGigi が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
thephpleague/climate#220 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 73/100
ppy/osu-web#13514 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
stable/10 Publish fails: semantic-release requires Node >= 22.14, workflow sets up Node 20対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug needs-triage
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
camunda/orchestration-cluster-api-php#162 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信