-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
…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 <[email protected]> Co-authored-by: tjcafferkey <[email protected]> Co-authored-by: michalczaplinski <[email protected]>
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 <[email protected]> Co-authored-by: tjcafferkey <[email protected]> Co-authored-by: michalczaplinski <[email protected]>
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 <[email protected]> Co-authored-by: tjcafferkey <[email protected]> Co-authored-by: michalczaplinski <[email protected]>
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/loginout
blocksblock.json
file.firstChild
,before
andafter
and 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.)