Make WordPress Core

Opened 14 months ago

Last modified 14 months ago

#58432 new defect (bug)

BUG: Custom Core Block Variation details not updated in "Settings Sidebar" section

Reported by: deepakvijayan's profile deepakvijayan Owned by:
Milestone: Awaiting Review Priority: normal
Severity: major Version:
Component: Editor Keywords: has-testing-info has-screenshots
Focuses: javascript Cc:

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.

How to reproduce:

  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.
  1. Add new core block variation and check the siderbar with the block selected.

Attaching pic & screen recording of the issue as well.

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

Attachments (2)

Screenshot 2023-05-31 at 11.23.26 AM.png (259.0 KB) - added by deepakvijayan 14 months ago.
Custom Core Block Variation.mov (5.2 MB) - added by deepakvijayan 14 months ago.

Change History (4)

This ticket was mentioned in Slack in #core-test by ironprogrammer. View the logs.


14 months ago

#2 @monzuralam
14 months ago

  • Keywords has-testing-info has-screenshots added

Thank you for the detailed report, @deepakvijayan!

As this deals with the Editor component, it is suggested to file this as a Gutenberg issue. Either you or another contributor can do this.

Once filed in Gutenberg, please cross-link this ticket and the GB issue so that contributors can easily trace the history. Thanks!

Note: See TracTickets for help on using tickets.