-
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
Core group block as inner block shows the block variation picker #64005
Comments
@upham-ui Could you add what the expected behavior is, and why you believe that it should work that way? It's unclear to me why the variation picker is not the right thing for the inner group block to show. |
@talldan sure. I updated the original issue. Here's what I added: Expected BehaviorWhen I add a core/group block to an innerBlock template, that core/group block should be added to the editor fully initialized, assuming those group blocks have the attributes that specify their fully initialized configuration (as a Group, Row, or Stack, for example). Furthermore, any blocks within that group block should be added to the editor. Actual BehaviorGroup blocks in the innerBlocks template are displayed in the editor with the block variation picker and attributes added to them in the template are gone, as are any innerBlocks added to them. |
There are two separate things happening with your example. The first is that the outer group block's variation There has been some progress on improving the situation - #63100. My advice would be not to use The second is the inner group block doesn't retain the classnames specified in the template. You can fix your example by removing the incorrect wp.domReady(() => {
wp.blocks.registerBlockVariation("core/group", {
name: "accordion",
title: "Accordion",
icon: "list-view",
attributes: {
className: "folder has-children",
},
innerBlocks: [
[
"core/group",
{
className: "accordion-button folder-header collapsible",
layout: {
type: 'default'
},
},
],
],
isActive: ["className"],
}) To specify some inner blocks you can add a third item in the array: [
"core/group",
{
className: "accordion-button folder-header collapsible",
layout: {
type: 'default'
},
},
[
[ "core/paragraph", { content: "Test" } ]
]
] |
Incredibly helpful. I had given up on the isActive; I assumed it had to do with core variations or something like that. But I was clueless about the form of the innerBlocks object. Thank you! |
Glad it helped. I'll close the issue if that's ok as the remaining problem is already tracked in #41303. |
Description
If I try to add a core/group block to the innerBlocks of a block variation (also of the core/group block) the block does not initialize properly, instead I see the experimental block variation picker. This prevents being able to set attributes on those inner blocks or adding inner blocks to them as well.
Expected Behavior
When I add a core/group block to an innerBlock template, that core/group block should be added to the editor fully initialized, assuming those group blocks have the attributes that specify their fully initialized configuration (as a Group, Row, or Stack, for example). Furthermore, any blocks within that group block should be added to the editor.
Actual Behavior
Group blocks in the innerBlocks template are displayed in the editor with the block variation picker and attributes added to them in the template are gone, as are any innerBlocks added to them.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Environment info
WP 6.6.1.
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
The text was updated successfully, but these errors were encountered: