Imported pages nest 9-13 levels deep, and the collapsible share of that is ~1 level

Open
#1,904 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
php, wordpress
Domain
frontend, tooling

Research direction

Start by reading the hasIndependentWrapperOwnership rule and the two assertions described in the issue, then inspect the parse_blocks measurements and the editor store's List View representation. The next step requires an owner to choose between changing the tree presentation and moving the folding boundary. Done means the selected direction is agreed and its existing contracts remain covered by the suite.

Written by the indexing model from the issue text.

Description

What this is

Not a bug report. A measurement, and a question for the owners of the wrapper-folding rule, because the obvious fix contradicts two contracts that look deliberate.

Measurement

A small four-page Weebly source, imported and inspected in the editor. Group-like blocks against total blocks, and the depth of the deepest path:

page blocks wrappers wrapper % depth
home 29 19 66% 11
print/audio 71 43 61% 11
photo 37 16 43% 9
blog 135 88 65% 13

The deepest path on the blog page, with what each level carries:

0  group   .wrapper                                    page wrapper
1  layout-shell [1]                                    already folded
2  columns .wsite-not-footer                           layout table
3  column
4  group   .blog-body            + geometry carrier
5  group   .blocks-engine-editor-anchor-wsite-content  anchor target
6  group   .blog-post + editor-anchor-blog-post-...    anchor target
7  group   .blog-content                               projected CSS hook
8  group   .wsite-multicol                             no style, one child
9  group   .wsite-multicol-table-wrap + carrier, margin 0
10 columns .wsite-multicol-table
11 column  padding 15px
12 group   .paragraph                                  projected CSS hook
13 paragraph

Every wrapper carries a blocks-engine-source-div-* projection class, so the author stylesheet is addressed against these exact divs. Unwrapping them is not available.

Counting what could fold under a rule of "a wrapper whose declared presentation resolves to nothing visible is not independently owned": 1-3 chains per page, worth about one level of depth each.

Why I did not ship it

Relaxing hasIndependentWrapperOwnership that way fails two assertions that read as intentional:

  • a media-only container retains intrinsic height when its visual layer is out of flow - a generated geometry carrier has to stay a block.
  • 6: styled wrappers remain owned native boundaries with their direct child topology - a wrapper declaring margin-top:0 stays an owned boundary, which is exactly the "neutral spacing" case.

So the current line is drawn on purpose: a wrapper keeps its own block so its presentation stays editable, and folding is reserved for wrappers that own nothing. By that line these pages are already close to optimal, and the depth is the source's own DOM depth rather than slop the importer added.

The question

The cost lands on a reader rather than on rendering. In List View a 13-level chain of Group entries is mostly static source scaffolding that reads exactly like content the user is meant to edit. Two directions, both needing an owner's call:

  1. Leave the tree alone and let the editor tell the difference - present a folded or already-owned scaffolding wrapper differently from an editable Group, so depth stops costing attention.
  2. Move the line - let a wrapper whose presentation resolves to nothing visible fold, and accept that its zero-valued declaration stops being editable through the block. That is the change the two assertions above currently forbid.

Happy to implement either. I did not want to flip a tested decision unilaterally for one level of depth.

AI assistance disclosure

Measured and written with AI assistance - grok-4.6 via OpenCode - from a live import: block trees read through the editor store, wrapper counts and deepest paths computed with parse_blocks, and the folding rule exercised against the suite to find which contracts it breaks. A human retains review and merge authority.

Dominant language
PHP
Stars
15
Forks
2
Avg merge
2h 21m
Merged PRs (30d)
796

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Automattic/blocks-engine

All issues in Automattic/blocks-engine

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.