| @@ -831,8 +831,16 @@ | ||
| 831 | 831 | '; |
| 832 | 832 | $responsive_container_content_directives = ' |
| 833 | 833 | data-wp-watch="callbacks.focusFirstElement" |
| 834 | 834 | '; |
| 835 | + | |
| 836 | + // The default overlay displays every submenu it contains; a custom overlay | |
| 837 | + // opts out through the `disable-default-overlay` class on this container. | |
| 838 | + // Submenus inherit this flag to tell the two apart, derived from the same | |
| 839 | + // value as that class so the markup and the styles cannot disagree. | |
| 840 | + if ( $has_custom_overlay ) { | |
| 841 | + $responsive_container_directives .= ' ' . wp_interactivity_data_wp_context( array( 'hasCustomOverlay' => true ) ); | |
| 842 | + } | |
| 835 | 843 | } |
| 836 | 844 | |
| 837 | 845 | // Don't apply overlay inline styles if using a custom overlay template part. |
| 838 | 846 | // The custom overlay is responsible for its own styling. |
| @@ -1046,8 +1054,12 @@ | ||
| 1046 | 1054 | $attributes['customBackgroundColor'] = $attributes['rgbBackgroundColor']; |
| 1047 | 1055 | } |
| 1048 | 1056 | |
| 1049 | 1057 | unset( $attributes['rgbTextColor'], $attributes['rgbBackgroundColor'] ); |
| 1058 | + | |
| 1059 | + // Submenu detection is memoized while a navigation block renders. Reset it so | |
| 1060 | + // the result of a previously rendered navigation block is not reused for this one. | |
| 1061 | + static::$has_submenus = false; | |
| 1050 | 1062 | |
| 1051 | 1063 | $inner_blocks = static::get_inner_blocks( $attributes, $block ); |
| 1052 | 1064 | // Prevent navigation blocks referencing themselves from rendering. |
| 1053 | 1065 | if ( gutenberg_block_core_navigation_block_tree_has_block_type( |