Make WordPress Core

Opened 8 months ago

Closed 8 months ago

Last modified 8 months ago

#61440 closed defect (bug) (fixed)

Fix inconsistency of block style variation names causing duplicate UI options

Reported by: aaronrobertshaw's profile aaronrobertshaw Owned by: oandregal's profile oandregal
Milestone: 6.6 Priority: normal
Severity: normal Version: 6.6
Component: Editor Keywords: gutenberg-merge has-patch
Focuses: Cc:

Description

This ticket tracks the backporting of PHP files for the following Gutenberg fix:

https://github.com/WordPress/gutenberg/pull/62550

These changes prevent an incorrect duplicate block style from appearing within the block styles panel due to inconsistencies between variation names due to case sensitivity.

This fix then also means that variation definitions from different sources get merged and applied correctly.

Change History (3)

This ticket was mentioned in PR #6824 on WordPress/wordpress-develop by @aaronrobertshaw.


8 months ago
#1

  • Keywords has-patch added

Backports the PHP changes from https://github.com/WordPress/gutenberg/pull/62550 fixing an issue with duplicate block style options appearing and variation definitions from different sources not merging correctly.

Test Instructions:

  1. Register a block style variation via register_block_style snippet below
    register_block_style(
                            'core/group',
                            array(
                                    'name'         => 'MyVariation',
                                    'label'        => __( 'My variation', 'twentytwentyfour' ),
                                    'inline_style' => '
                                    .is-style-MyVariation {
                                            background-color: red;
                                    }',
                            )
                    );
    
  1. Create theme.json partial file within /styles/partial.json using the following snippet
    {
        "$schema": "https://schemas.wp.org/trunk/theme.json",
        "version": 2,
        "title": "My variation",
        "slug": "MyVariation",
        "blockTypes": [ "core/group" ],
        "styles": {
                "color": {
                        "background": "blue",
                        "text": "white"
                }
        }
    }
    
  1. Open the site editor, select a group block and confirm only a single block style option other than default
  2. Select that block style and confirm that the partial theme.json files' style applies correctly

Trac ticket: https://core.trac.wordpress.org/ticket/61440

#2 @oandregal
8 months ago

  • Owner set to oandregal
  • Resolution set to fixed
  • Status changed from new to closed

In 58413:

Section styles: add slug to override non-kebab-cased variations.

Props aaronrobertshaw, oandregal.
Fixes #61440.

Note: See TracTickets for help on using tickets.