Repository navigation
Conversation
|
Size Change: +52 B (0%) Total Size: 7.72 MB 📦 View Changed
|
|
Flaky tests detected in 479392d. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/29439955199
|
f82297b to
9812979
Compare
9812979 to
9f8a5bf
Compare
|
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. |
There was a problem hiding this comment.
I don't think this is working as intended. The alignment control is also being passed down through to the child track.
Also, I'm unsure about the overall API design here. Even if it does work as intended, the Add button has to go in it's own toolbar group, and I'm not sure that's the final design we'd want. I assumed it would go in the same group as "Add"
1383e74 to
8bbfa94
Compare
You're right. I've fixed this. |
Do you mean:
I think it makes sense to be in its own group, since this action relates to the parent block. This is a question for @fcoveram and @jasmussen: We already have a feature that allows parent blocks to optionally share their toolbars with child blocks - the buttons block is an example. This PR brings in the ability for parent blocks to decide which parts of the toolbar to share - rather than sharing all controls:
Thanks! |
Yes, sorry. I thought they would go in the same group since they're about modifying the track list. I can see why the parent tools passed down should be in their own group for clarity. |
|
@scruffian Is the specific issue here that the |
|
Yes that was the issue i was trying to solve. Maybe you're right, we can just use __experimentalExposeControlsToChildren |
|
I'm doing that in #80368 |
|
Closing in favor of #80368 |
What?
Adds granular control over which parent block toolbar controls are exposed when a child block is selected.
Parent blocks can keep using
supports.__experimentalExposeControlsToChildren: trueto expose every control that opts into child sharing. They can now also pass an allow-list, for examplesupports.__experimentalExposeControlsToChildren: [ 'media' ], and controls can opt into that list with__experimentalShareWithChildBlocks="media".This also updates the Playlist block to use the new granular behavior so its Add media control is owned by the parent Playlist block while still appearing for selected Playlist Track children.
Why?
Some parent blocks need to share one specific toolbar control with child blocks without exposing every parent control that has opted into child sharing.
For Playlist, this avoids plumbing the add-tracks callback through child block context just so each Playlist Track can render the parent's Add control.
How?
__experimentalExposeControlsToChildrensupport value through block edit context as eithertrue, an allow-list, orfalse.BlockControlsfills to name shared child controls with__experimentalShareWithChildBlocks="name".mediacontrol to child tracks.Testing Instructions
Automated tests
Run:
Confirm all suites pass.
Manual smoke test: legacy boolean behavior
Start the environment if it is not already running:
Open the editor and insert a parent block that already uses
supports.__experimentalExposeControlsToChildren: true, such as Buttons.Select a child block inside that parent, such as an individual Button block.
Confirm the parent toolbar controls that were previously shared with child blocks are still available.
Select the parent block directly and confirm its own toolbar controls still render as expected.
Manual smoke test: Playlist granular behavior
Screenshots
Note that now the playlist track toolbar appears in the same place as the playlist block toolbar:

Note
We should remove the playlist specific commit from the PR (9f8a5bf). This is just for testing.
Automated Tests Run
npm run test:unit -- packages/block-editor/src/components/block-controls/test/index.js packages/block-editor/src/components/inner-blocks/test/index.js packages/block-library/src/playlist/test/edit-component.js