Skip to content

Commit

Permalink
Only pass aria-label when it is not empty (#67381)
Browse files Browse the repository at this point in the history
Co-authored-by: SantosGuillamot <[email protected]>
Co-authored-by: afercia <[email protected]>
  • Loading branch information
3 people authored Nov 28, 2024
1 parent daaa785 commit 007daf0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/block-library/src/navigation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -567,13 +567,14 @@ private static function get_nav_wrapper_attributes( $attributes, $inner_blocks )
$is_responsive_menu = static::is_responsive( $attributes );
$style = static::get_styles( $attributes );
$class = static::get_classes( $attributes );
$wrapper_attributes = get_block_wrapper_attributes(
array(
'class' => $class,
'style' => $style,
'aria-label' => $nav_menu_name,
)
$extra_attributes = array(
'class' => $class,
'style' => $style,
);
if ( ! empty( $nav_menu_name ) ) {
$extra_attributes['aria-label'] = $nav_menu_name;
}
$wrapper_attributes = get_block_wrapper_attributes( $extra_attributes );

if ( $is_responsive_menu ) {
$nav_element_directives = static::get_nav_element_directives( $is_interactive );
Expand Down

1 comment on commit 007daf0

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in 007daf0.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12070829662
📝 Reported issues:

Please sign in to comment.