Make WordPress Core

Changeset 58761


Ignore:
Timestamp:
07/18/2024 05:02:31 PM (2 months ago)
Author:
hellofromTonya
Message:

Block Themes: Fix invalid css for nested fullwidth layouts with zero padding applied

In the Layout block support, handle 0 values for padding as 0px in calc() rules. This resolves a bug for nested fullwidth layouts when zero padding is applied. Due to how calc() works, without supplying the unit, the rule will not
work, resulting in a horizontal scrollbar.

Ref: PHP changes from https://github.com/WordPress/gutenberg/pull/63436.

Reviewed by hellofromTonya.
Merges [58750] to the 6.6 branch.

Fixes #61656.
Props andrewserong, mukesh27, aaronrobertshaw.

Location:
branches/6.6
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.6

  • branches/6.6/src/wp-includes/block-supports/layout.php

    r58243 r58761  
    323323             */
    324324            if ( isset( $block_spacing_values['declarations']['padding-right'] ) ) {
    325                 $padding_right   = $block_spacing_values['declarations']['padding-right'];
     325                $padding_right = $block_spacing_values['declarations']['padding-right'];
     326                // Add unit if 0.
     327                if ( '0' === $padding_right ) {
     328                    $padding_right = '0px';
     329                }
    326330                $layout_styles[] = array(
    327331                    'selector'     => "$selector > .alignfull",
     
    330334            }
    331335            if ( isset( $block_spacing_values['declarations']['padding-left'] ) ) {
    332                 $padding_left    = $block_spacing_values['declarations']['padding-left'];
     336                $padding_left = $block_spacing_values['declarations']['padding-left'];
     337                // Add unit if 0.
     338                if ( '0' === $padding_left ) {
     339                    $padding_left = '0px';
     340                }
    333341                $layout_styles[] = array(
    334342                    'selector'     => "$selector > .alignfull",
Note: See TracChangeset for help on using the changeset viewer.