Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/wp-includes/block-supports/aria-label.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ function wp_apply_aria_label_support( $block_type, $block_attributes ) {
}

$has_aria_label_support = block_has_support( $block_type, array( 'ariaLabel' ), false );
if ( ! $has_aria_label_support ) {
if (
! $has_aria_label_support ||
wp_should_skip_block_supports_serialization( $block_type, 'ariaLabel' )
) {
return array();
}

Expand Down
11 changes: 9 additions & 2 deletions tests/phpunit/tests/block-supports/aria-label.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ private function register_aria_label_block_with_support( $block_name, $supports
}

/**
* Tests that position block support works as expected.
* Tests that aria-label block support works as expected.
*
* @ticket 62919
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good if we add ticket number here also

*
* @dataProvider data_aria_label_block_support
*
* @param boolean|array $support Aria label block support configuration.
* @param string $value Aria label value for attribute object.
* @param array $expected Expected aria label block support styles.
* @param array $expected Expected aria-label attributes.
*/
public function test_wp_apply_aria_label_support( $support, $value, $expected ) {
$block_type = self::register_aria_label_block_with_support(
Expand Down Expand Up @@ -82,6 +82,13 @@ public function data_aria_label_block_support() {
'value' => 'Label',
'expected' => array(),
),
'aria-label attribute is not applied when serialization is skipped' => array(
'support' => array(
'__experimentalSkipSerialization' => true,
),
'value' => 'Label',
'expected' => array(),
),
);
}
}
Loading