Fix for current_parsed_blocks value when block has inner blocks#26291
Conversation
|
Size Change: 0 B Total Size: 1.2 MB ℹ️ View Unchanged
|
mkaz
left a comment
There was a problem hiding this comment.
Tested this out and works as expected. 👍
The change makes sense, make sure the global has the right value before render and replace it with the previous value after.
|
cc @tellthemachines we need this (or an alternative that fixes the bug) for the release. Flagging in case I'm not around when that happens. |
f9ce774 to
519a496
Compare
|
I think the change is solid, but there's a couple of things I don't know how to do:
It's a bit late over here so I'll leave the PR unmerged so others can chime in. |
|
@nosolosw I believe the process is to open a core ticket with the diff. I created a ticket and diff here: https://core.trac.wordpress.org/ticket/51569 |
|
Thanks for flagging, Fabian. I see there's a core ticket https://core.trac.wordpress.org/ticket/51612 for this as well as a potential solution at WordPress/wordpress-develop#691 |
In #26192 we refactored the block supports mechanism. It works by holding a global
$current_parsed_blocksreference that it uses to determine the attributes that it needs to add to blocks.However, when a block has inner blocks, that reference isn't updated so inner blocks end up inheriting the parent's properties (style and classes).
How to test
This is what I've done:
wp-includes/class-wp-block.phpclass with the contents of this PR.lielements) don't have thewp-social-linksclass attached. It should be present in the parent (ulelement).