Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widget Importer: ensure it works with importing menus #47285

Open
annezazu opened this issue Jan 19, 2023 · 9 comments
Open

Widget Importer: ensure it works with importing menus #47285

annezazu opened this issue Jan 19, 2023 · 9 comments
Assignees
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Bug An existing feature does not function as intended

Comments

@annezazu
Copy link
Contributor

This was found as part of the FSE Outreach Program's twentieth call for testing:

For me, only the calendar widget imported. The menu and categories widgets did not import. I could repeat this several times once I knew what to do to allow importing the widget areas.

I could only replicate issues with the menu import using GB 15.0 and WordPress 6.1.1:

Screen Shot 2023-01-19 at 6 21 30 AM

@annezazu annezazu added [Type] Bug An existing feature does not function as intended [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") labels Jan 19, 2023
@ndiego ndiego moved this to ❓ Triage in WordPress 6.2 Editor Tasks Jan 19, 2023
@Mamaduka
Copy link
Member

The Menu and Meta core widgets don't have transformations to blocks; it is the reason it's skipped during import. See #45509 (comment).

The Legacy Widget block doesn't work in Site Editor; We try to transform widgets into blocks; if this fails, we'll skip them and display the notice.

@noisysocks, do you remember the complications of adding the Menu widget transformation?

@noisysocks
Copy link
Member

There isn't a transformation for the Meta widget because we have no analogous block for it. Should there be a Meta block, @mtias?

There isn't a transformation for the Menu widget because there was no need for one in the Widgets Editor which currently does not support the Navigation block (see #36469 for why).

It should be easy enough to add a Menu widget → Navigation block transformation but continue to disable the Navigation block in the Widgets Editor.

@Mamaduka
Copy link
Member

Thank you for the context, @noisysocks!

@noisysocks
Copy link
Member

It should be easy enough to add a Menu widget → Navigation block transformation

I started looking into this and the difficult bit is that we need to load the classic menu in order to transform it but unfortunately we don't yet support async transforms (#14755). We can either implement async transforms or add some wacky classicMenu attribute to the navigation block which tells the block to convert a classic menu upon initialisation.

@Mamaduka
Copy link
Member

I personally would preferer using async transforms, and the feature would also be helpful in other places. The Navigation block is complicated; it doesn't seem right to add extra logic just for this case.

@noisysocks
Copy link
Member

Yeah agreed.

@Mamaduka
Copy link
Member

@annezazu, I think it makes sense to punt this for WP 6.3 and implement it properly with async transformations.

@Mamaduka Mamaduka moved this from ❓ Triage to 🦵 Punted to 6.3 in WordPress 6.2 Editor Tasks Jan 25, 2023
@annezazu
Copy link
Contributor Author

Sounds good. I trust your read here!

@noisysocks
Copy link
Member

I no longer think async transforms are a practical option. See #14755 (comment).

I started trying to solve this using the approach I outlined in that comment but then ran into a drawback that I don't like which is that doing this involves fetching all of the menus and menu items when the block editor is initialised.

Back to the drawing board 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants