Make WordPress Core

Changeset 58750


Ignore:
Timestamp:
07/18/2024 06:48:08 AM (2 months ago)
Author:
noisysocks
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.

Backports the PHP changes in https://github.com/WordPress/gutenberg/pull/63436.

Fixes #61656.
Props andrewserong, mukesh27, aaronrobertshaw.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-supports/layout.php

    r58708 r58750  
    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.