| @@ -416,9 +416,9 @@ | ||
| 416 | 416 | * |
| 417 | 417 | * @since 6.5.0 |
| 418 | 418 | * |
| 419 | 419 | * @param string $overlay_template_part_id The overlay template part ID in format "theme//slug". |
| 420 | - * @param array $attributes The block attributes. | |
| 420 | + * @param array $attributes The block attributes. | |
| 421 | 421 | * @return WP_Block_List Returns the inner blocks for the overlay template part. |
| 422 | 422 | */ |
| 423 | 423 | private static function get_overlay_blocks_from_template_part( $overlay_template_part_id, $attributes ) { |
| 424 | 424 | if ( empty( $overlay_template_part_id ) || ! is_string( $overlay_template_part_id ) ) { |
| @@ -517,9 +517,9 @@ | ||
| 517 | 517 | * |
| 518 | 518 | * @since 6.5.0 |
| 519 | 519 | * |
| 520 | 520 | * @param array $attributes The block attributes. |
| 521 | - * @param WP_Block $block The parsed block. | |
| 521 | + * @param WP_Block $block The parsed block. | |
| 522 | 522 | * @return WP_Block_List Returns the inner blocks for the navigation block. |
| 523 | 523 | */ |
| 524 | 524 | private static function get_inner_blocks( $attributes, $block ) { |
| 525 | 525 | $inner_blocks = $block->inner_blocks; |
| @@ -739,10 +739,10 @@ | ||
| 739 | 739 | * Get the responsive container markup |
| 740 | 740 | * |
| 741 | 741 | * @since 6.5.0 |
| 742 | 742 | * |
| 743 | - * @param array $attributes The block attributes. | |
| 744 | - * @param WP_Block_List $inner_blocks The list of inner blocks. | |
| 743 | + * @param array $attributes The block attributes. | |
| 744 | + * @param WP_Block_List $inner_blocks The list of inner blocks. | |
| 745 | 745 | * @param string $inner_blocks_html The markup for the inner blocks. |
| 746 | 746 | * @return string Returns the container markup. |
| 747 | 747 | */ |
| 748 | 748 | private static function get_responsive_container_markup( $attributes, $inner_blocks, $inner_blocks_html ) { |
| @@ -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. |
| @@ -891,10 +899,10 @@ | ||
| 891 | 899 | * Get the wrapper attributes |
| 892 | 900 | * |
| 893 | 901 | * @since 6.5.0 |
| 894 | 902 | * |
| 895 | - * @param array $attributes The block attributes. | |
| 896 | - * @param WP_Block_List $inner_blocks A list of inner blocks. | |
| 903 | + * @param array $attributes The block attributes. | |
| 904 | + * @param WP_Block_List $inner_blocks A list of inner blocks. | |
| 897 | 905 | * @return string Returns the navigation block markup. |
| 898 | 906 | */ |
| 899 | 907 | private static function get_nav_attributes( $attributes, $inner_blocks ) { |
| 900 | 908 | $is_interactive = static::is_interactive( $attributes, $inner_blocks ); |
| @@ -978,9 +986,9 @@ | ||
| 978 | 986 | * Returns the markup for the navigation block. |
| 979 | 987 | * |
| 980 | 988 | * @since 6.5.0 |
| 981 | 989 | * |
| 982 | - * @param array $attributes The block attributes. | |
| 990 | + * @param array $attributes The block attributes. | |
| 983 | 991 | * @param WP_Block_List $inner_blocks The list of inner blocks. |
| 984 | 992 | * @return string Returns the navigation wrapper markup. |
| 985 | 993 | */ |
| 986 | 994 | private static function get_inner_block_markup( $attributes, $inner_blocks ) { |
| @@ -1047,8 +1055,12 @@ | ||
| 1047 | 1055 | } |
| 1048 | 1056 | |
| 1049 | 1057 | unset( $attributes['rgbTextColor'], $attributes['rgbBackgroundColor'] ); |
| 1050 | 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; | |
| 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( |
| 1054 | 1066 | $inner_blocks, |
| @@ -1785,14 +1797,14 @@ | ||
| 1785 | 1797 | * @since 5.9.0 |
| 1786 | 1798 | * |
| 1787 | 1799 | * @deprecated 6.3.0 Use WP_Navigation_Fallback::parse_blocks_from_menu_items() instead. |
| 1788 | 1800 | * |
| 1789 | - * @param array $menu_items An array of menu items that represent | |
| 1790 | - * an individual level of a menu. | |
| 1791 | - * @param array $menu_items_by_parent_id An array keyed by the id of the | |
| 1792 | - * parent menu where each element is an | |
| 1793 | - * array of menu items that belong to | |
| 1794 | - * that parent. | |
| 1801 | + * @param array $menu_items An array of menu items that represent | |
| 1802 | + * an individual level of a menu. | |
| 1803 | + * @param array $menu_items_by_parent_id An array keyed by the id of the | |
| 1804 | + * parent menu where each element is an | |
| 1805 | + * array of menu items that belong to | |
| 1806 | + * that parent. | |
| 1795 | 1807 | * @return array An array of parsed block data. |
| 1796 | 1808 | */ |
| 1797 | 1809 | function gutenberg_block_core_navigation_parse_blocks_from_menu_items( $menu_items, $menu_items_by_parent_id ) { |
| 1798 | 1810 | |
| @@ -1890,9 +1902,9 @@ | ||
| 1890 | 1902 | * @since 6.2.0 |
| 1891 | 1903 | * |
| 1892 | 1904 | * @deprecated 6.3.0 Use WP_Navigation_Fallback::get_classic_menu_fallback_blocks() instead. |
| 1893 | 1905 | * |
| 1894 | - * @param object $classic_nav_menu WP_Term The classic navigation object to convert. | |
| 1906 | + * @param object $classic_nav_menu WP_Term The classic navigation object to convert. | |
| 1895 | 1907 | * @return array the normalized parsed blocks. |
| 1896 | 1908 | */ |
| 1897 | 1909 | function gutenberg_block_core_navigation_get_classic_menu_fallback_blocks( $classic_nav_menu ) { |
| 1898 | 1910 | |