Skip to content

Conversation

@gziolo
Copy link
Member

@gziolo gziolo commented May 5, 2023

What?

Follow-up for #50079.
Fixes #50211.

The mobile version of Navigation menu toggle doesn't work after updating to latest nightly version.

Why?

The view scripts registered in WordPress core for core blocks weren't correctly deregistered before registering again in the Gutenberg plugin. It was handled by a hook in the polyfill removed after we dropped support for WordPress 6.0.

How?

Ensure that all view scripts coming from core blocks are correctly deregistered just before the block gets unregistered.

Testing Instructions

  1. Go to the mobile version of the Navigation menu.
  2. Try to open the menu on the site as visitor.

@gziolo gziolo requested a review from spacedmonkey as a code owner May 5, 2023 08:05
@gziolo gziolo self-assigned this May 5, 2023
@gziolo gziolo added Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts [Type] Bug An existing feature does not function as intended labels May 5, 2023
Copy link
Contributor

@SantosGuillamot SantosGuillamot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested it, and it seems to work fine with this fix. Thanks for the PR, Greg! 🙂

Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the navigation asset issue ✅

P.S. I don't like that we're getting a registry inside the loop, but the DRY approach here makes sense.

@gziolo gziolo enabled auto-merge (squash) May 5, 2023 08:26
@gziolo
Copy link
Member Author

gziolo commented May 5, 2023

P.S. I don't like that we're getting a registry inside the loop, but the DRY approach here makes sense.

It's a singletone so it's just a reference you get through a function wrapper.

@Mamaduka
Copy link
Member

Mamaduka commented May 5, 2023

It's a singletone so it's just a reference you get through a function wrapper.

I know :) It's just a pattern I like to avoid. Personal taste 🍕

@gziolo gziolo merged commit 837ec8e into trunk May 5, 2023
@gziolo gziolo deleted the fix/view-script-handles-core-block branch May 5, 2023 08:33
@github-actions github-actions bot added this to the Gutenberg 15.8 milestone May 5, 2023
@ramonjd ramonjd added the Needs PHP backport Needs PHP backport to Core label Jun 5, 2023
@ramonjd ramonjd removed the Needs PHP backport Needs PHP backport to Core label Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The mobile menu toggle doesn't work

5 participants