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 <santosguillamot@git.wordpress.org>
Co-authored-by: afercia <afercia@git.wordpress.org>
  • Loading branch information
3 people authored and michalczaplinski committed Dec 5, 2024
1 parent 5d67ff6 commit d7f9367
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

0 comments on commit d7f9367

Please sign in to comment.