Automattic / Automattic/blocks-engine
Emit computed layout graphs for pseudo-form roots
- Dominant language
- PHP
- Stars
- 14
- Forks
- 2
- Avg merge
- 2h 10m
- Merged PRs (30d)
- 561
Description
## Problem
The merged generic form-layout producer treats only literal `` elements as layout-graph roots. `formFallbackFinding()` invokes it for both real forms and div-based pseudo-forms, but `FormLayoutGraphBuilder::collect()` returns before visiting controls when the root tag is not `form`. Styled pseudo-forms therefore emit `generic/computed-layout-graph/v1` with `nodes: []`, no variants, and no diagnostic.
## Work
- Treat the bounded fallback element passed to the builder as the graph root independent of its tag name.
- Preserve control references, wrapper parentage, computed layout, conditional variants, and existing bounds.
- Keep form semantics separate from generic layout topology.
- Emit explicit loss when a pseudo-form root cannot be represented.
## Acceptance
- A styled div pseudo-form emits a root layout node and source-ordered control parentage.
- Literal form behavior remains unchanged.
- Empty graphs cannot silently claim successful layout capture.
- PHP transformer contract and full suites pass.
Found while reviewing merged PR #719 through GPT-5.6 Sol in OpenCode; Chris owns the issue and acceptance criteria.
Contributor guide
Research direction
Start with FormLayoutGraphBuilder::collect() and the formFallbackFinding() call path to compare literal form and pseudo-form roots. Verify control references, wrapper parentage, computed layout, variants, and bounds, then run the PHP transformer contract and full suites; done means styled div pseudo-forms emit non-empty graphs while literal form behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100