Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#61440 closed defect (bug) (fixed)

Fix inconsistency of block style variation names causing duplicate UI options

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

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.


2 years 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
2 years ago

  • Owner set to oandregal
  • Resolutionfixed
  • Status newclosed

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.