-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: Fix toggle with Navigation block #59277
Conversation
… on the current block
Size Change: +89 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
Flaky tests detected in af03c88. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/8006674137
|
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. |
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.
I realize it was me who originally suggested adding a special case for the Navigation block 🙈 but after some testing, it looks as if we can always use getBlocks()
instead 😅
(I've tried inserting hooked blocks after
Post Content and as Comment Template's lastChild
, and getBlocks
returned the relevant candidate blocks as desired in all cases.)
Closing in favor of #59367 🙂 |
Fixes #59001
What?
Update the block hooks toggle to use the getBlocks selector to return controlled innerBlocks, which the getBlock selector does not return.
Why?
The getBlock selector doesn't return controller innerBlocks, only uncontrolled. This means when toggling the block hooks toggle on/off it was multiplying the hooked block.
How?
This correctly returns the innerBlocks for the Navigation block. At the moment we have limited this change to only the Navigation block.
Testing Instructions
core/loginout
blocksblock.json
file.firstChild
,before
andafter
and retest the above steps for each position.Testing Instructions for Keyboard
Screenshots or screencast