Skip to content

Commit

Permalink
Fix: empty style attribute issue in navigation block (#62600)
Browse files Browse the repository at this point in the history
* Fix: empty style attribute issue in navigation block

* update: store overlay style to variable for better readibility and performance

* Fix: linting issue

* Fix: added missing quotes to make valid markup

----

Unlinked contributors: convolutedkdlkf.

Co-authored-by: up1512001 <[email protected]>
Co-authored-by: artemiomorales <[email protected]>
Co-authored-by: talldan <[email protected]>
  • Loading branch information
4 people authored and ellatrix committed Jun 25, 2024
1 parent 861b089 commit f6c7337
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/block-library/src/navigation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,11 @@ private static function get_responsive_container_markup( $attributes, $inner_blo
';
}

$overlay_inline_styles = esc_attr( safecss_filter_attr( $colors['overlay_inline_styles'] ) );

return sprintf(
'<button aria-haspopup="dialog" %3$s class="%6$s" %10$s>%8$s</button>
<div class="%5$s" style="%7$s" id="%1$s" %11$s>
<div class="%5$s" %7$s id="%1$s" %11$s>
<div class="wp-block-navigation__responsive-close" tabindex="-1">
<div class="wp-block-navigation__responsive-dialog" %12$s>
<button %4$s class="wp-block-navigation__responsive-container-close" %13$s>%9$s</button>
Expand All @@ -537,7 +539,7 @@ private static function get_responsive_container_markup( $attributes, $inner_blo
$toggle_aria_label_close,
esc_attr( implode( ' ', $responsive_container_classes ) ),
esc_attr( implode( ' ', $open_button_classes ) ),
esc_attr( safecss_filter_attr( $colors['overlay_inline_styles'] ) ),
( ! empty( $overlay_inline_styles ) ) ? "style=\"$overlay_inline_styles\"" : '',
$toggle_button_content,
$toggle_close_button_content,
$open_button_directives,
Expand Down

0 comments on commit f6c7337

Please sign in to comment.