Make WordPress Core


Ignore:
Timestamp:
06/21/2023 05:30:24 AM (20 months ago)
Author:
isabel_brison
Message:

Editor: update layout classnames and specificity.

Adds a compound layout classname and reduces layout spacing rule specificity.

Props ramonopoly, andrewserong, poena.
Fixes #58548.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-theme-json.php

    r55950 r55956  
    12471247     *
    12481248     * @since 6.1.0
     1249     * @since 6.3.0 Reduced specificity for layout margin rules.
    12491250     *
    12501251     * @param array $block_metadata Metadata about the block to get styles for.
     
    13431344                                    );
    13441345                                } else {
    1345                                     $format          = static::ROOT_BLOCK_SELECTOR === $selector ? '%s .%s%s' : '%s.%s%s';
     1346                                    $format          = static::ROOT_BLOCK_SELECTOR === $selector ? ':where(%s .%s) %s' : '%s-%s%s';
    13461347                                    $layout_selector = sprintf(
    13471348                                        $format,
     
    25612562        if ( $has_block_gap_support ) {
    25622563            $block_gap_value = static::get_property_value( $this->theme_json, array( 'styles', 'spacing', 'blockGap' ) );
    2563             $css            .= '.wp-site-blocks > * { margin-block-start: 0; margin-block-end: 0; }';
    2564             $css            .= ".wp-site-blocks > * + * { margin-block-start: $block_gap_value; }";
     2564            $css            .= ":where(.wp-site-blocks) > * { margin-block-start: $block_gap_value; margin-block-end: 0; }";
     2565            $css            .= ':where(.wp-site-blocks) > :first-child:first-child { margin-block-start: 0; }';
     2566            $css            .= ':where(.wp-site-blocks) > :last-child:last-child { margin-block-end: 0; }';
    25652567
    25662568            // For backwards compatibility, ensure the legacy block gap CSS variable is still available.
Note: See TracChangeset for help on using the changeset viewer.