Skip to content

Custom Core Block Variation details not updated in "Settings Sidebar" section #51486

@2xSamurai

Description

@2xSamurai

Description

Issue:

When adding a custom core block variation, the details ( title, icon, description ) are not updated in the "Settings Sidebar" section. Hence there is no way to distinguish between custom core block variations and core blocks once a block is added.

Note: I did report this earlier in core-trac without knowing that it had to be reported here. Below is the core trac reference.

https://core.trac.wordpress.org/ticket/58432

Step-by-step reproduction instructions

  1. Add support for block variations to your existing theme.
function prefix_editor_assets() {
	wp_enqueue_script(
		'prefix-block-variations',
		get_template_directory_uri() . '/assets/js/blocks/block-variations.js',
		array( 'wp-blocks' )
	);
}
add_action( 'enqueue_block_editor_assets', 'prefix_editor_assets' );
  1. Create a custom core block variation
wp.blocks.registerBlockVariation(
	'core/group',
	{
	    name: 'card-group',
	    title: 'Card group',
            description: 'A group with card styling',
            label: 'Card group',
            icon: 'wordpress',
            attributes: {
	       className: 'card-group',
            },
            innerBlocks: [
                [ 'core/heading', { content: '' } ],
                [ 'core/paragraph', { content: '' } ],
            ]
	}
);
  1. Check inside editor for new core block variation.
  2. Add new core block variation and check the siderbar with the block selected.

Note: I used the following tutorial by Carolina Nymark to create the variation
https://fullsiteediting.com/lessons/block-variations/

Screenshot 2023-05-31 at 11 23 26 AM (1)
Custom.Core.Block.Variation.mov

Screenshots, screen recording, code snippet

No response

Environment info

WordPress - 6.2.2
Theme - Twenty Twenty-Two

Tried with and without Guttenberg
Gutenberg: 15.9.1

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] BlocksOverall functionality of blocks[Package] Block editor/packages/block-editor[Type] BugAn existing feature does not function as intended

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions