Repository navigation
Block Bindings: Preserve nested lists when binding List Item content - #78991
Closed
cbravobernal wants to merge 7 commits into
Closed
cbravobernal wants to merge 7 commits into
cbravobernal wants to merge 7 commits into
Conversation
cbravobernal
requested review from
ajitbohra,
fabiankaegy,
juanmaguitar and
spacedmonkey
as code owners
June 6, 2026 12:33
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
cbravobernal
marked this pull request as draft
June 6, 2026 13:57
cbravobernal
force-pushed
the
add/list-item-block-bindings-v2
branch
from
June 7, 2026 09:58
6bcecfa to
dab2d81
Compare
cbravobernal
force-pushed
the
add/list-item-block-bindings-v2
branch
from
June 9, 2026 15:21
d4ae1c6 to
85e57e3
Compare
On WordPress versions without the WP_Block::replace_html() inner-blocks fix (wordpress-develop#12113), binding a List Item's content replaces the whole <li> and drops the nested List. The inner blocks remain on the instance, so re-append them after Core applies the binding. Replaces the previous ~500-line workaround (render_block_data stashing, a custom WP_HTML_Processor subclass and ReflectionMethod feature detection) now that Core resolves the binding value itself.
phpunit cases for nested, ordered, deeply nested, empty-value, raw-markup, non-list inner block and pattern-override bindings, plus e2e coverage.
cbravobernal
force-pushed
the
add/list-item-block-bindings-v2
branch
from
June 19, 2026 09:19
2edcb8d to
0349712
Compare
cbravobernal
marked this pull request as ready for review
June 19, 2026 10:39
Contributor
Author
|
Superseded by #79346, which uses the WordPress/gutenberg origin branch as the PR head. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the List Item block bindings work, split for review hygiene into two PRs (mirroring the Core split on Trac #65406):
core/list-itemcontentas a bindable attribute (theblock_bindings_supported_attributesfilter). This corresponds to wordpress-develop#12204.<li>, and the generic binding replacement in WordPress versions before 7.1 would drop the nested list. This corresponds to wordpress-develop#12113.Relationship to Core
Both Core PRs are merged for WordPress 7.1:
core/list-itemenablement in Core.WP_Block::replace_html()inner-blocks preservation.This PR keeps the Gutenberg plugin working on WordPress versions before 7.1 by re-appending rendered List Item inner blocks only when Core's binding replacement dropped them. On Core versions that already preserve the inner blocks, the workaround is a no-op because the nested rendered HTML is already present.
The workaround can be removed once the Gutenberg plugin's minimum required WordPress version is 7.1.
Use of AI Tools
AI tools (OpenAI Codex/ChatGPT) were used to help inspect the codebase, simplify the workaround, resolve conflicts, update PR metadata, and run or interpret local checks. The final code, tests, and PR updates were human-directed and reviewed by the PR author.