@@ -311,7 +327,9 @@ function render_block_core_navigation( $attributes, $content, $block ) {
$modal_unique_id,
$inner_blocks_html,
__( 'Open menu' ), // Open button label.
- __( 'Close menu' ) // Close button label.
+ __( 'Close menu' ), // Close button label.
+ implode( ' ', $responsive_container_classes ),
+ implode( ' ', $open_button_classes )
);
return sprintf(
diff --git a/packages/block-library/src/navigation/responsive-wrapper.js b/packages/block-library/src/navigation/responsive-wrapper.js
index b29cdbdef7c902..7030e8e7914abc 100644
--- a/packages/block-library/src/navigation/responsive-wrapper.js
+++ b/packages/block-library/src/navigation/responsive-wrapper.js
@@ -17,6 +17,7 @@ export default function ResponsiveWrapper( {
isOpen,
isResponsive,
onToggle,
+ isHiddenByDefault,
} ) {
if ( ! isResponsive ) {
return children;
@@ -25,8 +26,13 @@ export default function ResponsiveWrapper( {
'wp-block-navigation__responsive-container',
{
'is-menu-open': isOpen,
+ 'hidden-by-default': isHiddenByDefault,
}
);
+ const openButtonClasses = classnames(
+ 'wp-block-navigation__responsive-container-open',
+ { 'always-shown': isHiddenByDefault }
+ );
const modalId = `${ id }-modal`;
@@ -37,7 +43,7 @@ export default function ResponsiveWrapper( {
aria-haspopup="true"
aria-expanded={ isOpen }
aria-label={ __( 'Open menu' ) }
- className="wp-block-navigation__responsive-container-open"
+ className={ openButtonClasses }
onClick={ () => onToggle( true ) }
>