Make WordPress Core

Changeset 65877


Ignore:
Timestamp:
12/03/2026 08:06:32 AM (12 hours ago)
Author:
wildworks
Message:

Editor: Add space-around and space-evenly flex justification

Horizontal flex layouts now accept the space-around and space-evenly justification values, so blocks that use them render correctly.

Developed in ​https://github.com/WordPress/wordpress-develop/pull/13710

Props sukhendu2002, wildworks.
Fixes #66172.

Location:
trunk
Files:
2 edited

Legend:

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

    r65212 r65877  
    766766
    767767                if ( 'horizontal' === $layout_orientation ) {
    768                         $justify_content_options    += array( 'space-between' => 'space-between' );
     768                        $justify_content_options    += array(
     769                                'space-between' => 'space-between',
     770                                'space-around'  => 'space-around',
     771                                'space-evenly'  => 'space-evenly',
     772                        );
    769773                        $vertical_alignment_options += array( 'stretch' => 'stretch' );
    770774                } else {
  • trunk/tests/phpunit/tests/block-supports/layout.php

    r65212 r65877  
    13671367
    13681368        /**
     1369         * Tests additional flex justification values.
     1370         *
     1371         * @dataProvider data_wp_get_layout_style_with_additional_flex_justification
     1372         *
     1373         * @covers ::wp_get_layout_style
     1374         *
     1375         * @param array  $layout          Flex layout values.
     1376         * @param string $expected_output The expected output.
     1377         */
     1378        public function test_wp_get_layout_style_with_additional_flex_justification( $layout, $expected_output ) {
     1379                $this->assertSame( $expected_output, wp_get_layout_style( '.wp-layout', $layout ) );
     1380        }
     1381
     1382        /**
     1383         * Data provider for test_wp_get_layout_style_with_additional_flex_justification().
     1384         *
     1385         * @return array
     1386         */
     1387        public function data_wp_get_layout_style_with_additional_flex_justification() {
     1388                return array(
     1389                        'horizontal flex layout with space-around justification' => array(
     1390                                'layout'          => array(
     1391                                        'type'           => 'flex',
     1392                                        'orientation'    => 'horizontal',
     1393                                        'justifyContent' => 'space-around',
     1394                                ),
     1395                                'expected_output' => '.wp-layout{justify-content:space-around;}',
     1396                        ),
     1397                        'horizontal flex layout with space-evenly justification' => array(
     1398                                'layout'          => array(
     1399                                        'type'           => 'flex',
     1400                                        'orientation'    => 'horizontal',
     1401                                        'justifyContent' => 'space-evenly',
     1402                                ),
     1403                                'expected_output' => '.wp-layout{justify-content:space-evenly;}',
     1404                        ),
     1405                );
     1406        }
     1407
     1408        /**
    13691409         * Tests that a constrained layout with non-string contentSize/wideSize/justifyContent
    13701410         * values (e.g. from hand-edited, imported, or AI-generated content) does not cause a
Note: See TracChangeset for help on using the changeset viewer.