Make WordPress Core

Changeset 61671


Ignore:
Timestamp:
02/18/2026 06:11:15 AM (6 months ago)
Author:
wildworks
Message:

Block Support: Allow serialization skipping for ariaLabel

Allow skipping serialization for the ariaLabel block support. This enables applying the aria-label attribute to inner elements instead of the block wrapper.

Follow-up to [59925].

Props mukesh27, wildworks.
Fixes #64594.

Location:
trunk
Files:
2 edited

Legend:

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

    r59925 r61671  
    5050
    5151        $has_aria_label_support = block_has_support( $block_type, array( 'ariaLabel' ), false );
    52         if ( ! $has_aria_label_support ) {
     52        if (
     53                ! $has_aria_label_support ||
     54                wp_should_skip_block_supports_serialization( $block_type, 'ariaLabel' )
     55        ) {
    5356                return array();
    5457        }
  • trunk/tests/phpunit/tests/block-supports/aria-label.php

    r59925 r61671  
    4545
    4646        /**
    47          * Tests that position block support works as expected.
     47         * Tests that aria-label block support works as expected.
    4848         *
    4949         * @ticket 62919
     50         * @ticket 64594
    5051         *
    5152         * @dataProvider data_aria_label_block_support
     
    5354         * @param boolean|array $support  Aria label block support configuration.
    5455         * @param string        $value    Aria label value for attribute object.
    55          * @param array         $expected Expected aria label block support styles.
     56         * @param array         $expected Expected aria-label attributes.
    5657         */
    5758        public function test_wp_apply_aria_label_support( $support, $value, $expected ) {
     
    8384                                'expected' => array(),
    8485                        ),
     86                        'aria-label attribute is not applied when serialization is skipped' => array(
     87                                'support'  => array(
     88                                        '__experimentalSkipSerialization' => true,
     89                                ),
     90                                'value'    => 'Label',
     91                                'expected' => array(),
     92                        ),
    8593                );
    8694        }
Note: See TracChangeset for help on using the changeset viewer.