Block Hooks: Take controlled blocks into account for toggle state#59367
Conversation
|
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @pkuliga. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. 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. |
|
Size Change: -7 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
…9367) This is necessary to the correctly set the toggle state for hooked blocks inserted as first child or last child of the Navigation block. Unlinked contributors: pkuliga. Co-authored-by: ockham <bernhard-reiter@git.wordpress.org> Co-authored-by: tjcafferkey <tomjcafferkey@git.wordpress.org> Co-authored-by: michalczaplinski <czapla@git.wordpress.org>
|
I just cherry-picked this PR to the cherry-pick-wp-6-5-beta-3 branch to get it included in the next release: a3ab0c7 |
…9367) This is necessary to the correctly set the toggle state for hooked blocks inserted as first child or last child of the Navigation block. Unlinked contributors: pkuliga. Co-authored-by: ockham <bernhard-reiter@git.wordpress.org> Co-authored-by: tjcafferkey <tomjcafferkey@git.wordpress.org> Co-authored-by: michalczaplinski <czapla@git.wordpress.org>
|
I just cherry-picked this PR to the release/17.8 branch to get it included in the next release: 4369ada |
…9367) This is necessary to the correctly set the toggle state for hooked blocks inserted as first child or last child of the Navigation block. Unlinked contributors: pkuliga. Co-authored-by: ockham <bernhard-reiter@git.wordpress.org> Co-authored-by: tjcafferkey <tomjcafferkey@git.wordpress.org> Co-authored-by: michalczaplinski <czapla@git.wordpress.org>
What?
When setting the Block Hooks toggle state, take controlled blocks into account.
Why?
To fix #59001, i.e. the toggle state for hooked blocks inserted as first child or last child of the Navigation block.
How?
By using the
getBlocks( clientId )selector instead ofgetBlock( clientId ).innerBlocks(note the singular:getBlock()).This PR is based on @tjcafferkey's #59277. See #59277 (review) for more detail.
Testing Instructions
Verify that #59001 is fixed:
(Copied from #59277.)
core/loginoutblocksblock.jsonfile.firstChild,beforeandafterand retest the above steps for each position.Additionally, verify that the toggle still works as before for blocks inserted as _un_controlled inner blocks, e.g. as the Comment Template block's last child. (You can use this plugin to test.)