From ecd550ba6ce66ea37c203d3438a2eeb70f315d36 Mon Sep 17 00:00:00 2001 From: Luis Herranz Date: Tue, 30 May 2023 13:58:04 +0200 Subject: [PATCH] Navigation block: Set correct aria-expanded on hover (#50953) * Set correct aria-expanded on hover * Store both `click` and `hover` in `isMenuOpen` * Fix nav menu * Remove menuOpenedOn debugger * Add comments and fix example HTML * Fix PHP lint * Just in case openSubmenusOnClick exists but it's false * Switch to isMenuOpen selector in roleAttribute --- lib/experimental/interactivity-api/blocks.php | 62 +++++---- .../src/navigation/interactivity.js | 130 ++++++++++-------- 2 files changed, 109 insertions(+), 83 deletions(-) diff --git a/lib/experimental/interactivity-api/blocks.php b/lib/experimental/interactivity-api/blocks.php index 3ad6d13d660fb1..d9a2b1b2718a8c 100644 --- a/lib/experimental/interactivity-api/blocks.php +++ b/lib/experimental/interactivity-api/blocks.php @@ -35,18 +35,18 @@ function gutenberg_block_core_file_add_directives_to_content( $block_content, $b * * * * @param string $block_content Markup of the navigation block. + * @param array $block Block object. * * @return string Navigation block markup with the proper directives */ -function gutenberg_block_core_navigation_add_directives_to_markup( $block_content ) { +function gutenberg_block_core_navigation_add_directives_to_markup( $block_content, $block ) { $w = new WP_HTML_Tag_Processor( $block_content ); // Add directives to the `