-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Legacy widgets: Some widgets don't load all the scripts they need #22765
Comments
Documenting here why Site Origin widget bundle https://wordpress.org/plugins/so-widgets-bundle/ does not load correctly on legacy widgets. The widget initializes when a click to open the widget is made:
On the legacy widgets, the click does not happen so the widget is never initialized. The plugin has a different initialization for the customizer blocks
This initialization relies on the widget-added, on the customizer blocks the event happens so the widget works as expected. Fortunately, Site Origin widget bundle already implements a block similar to legacy widgets that allows to use their widgets in block areas and works well. The mechanism the block use can not replicate in the core because they are specific for the widgets the plugin contains. I will continue to do more tests with third party widgets and document why things did not worked or improve legacy widgets and make things work. |
This is blocked because it's not clear how much work should go into supporting non standard ways of "hooking" into WP admin. |
Let's do this:
|
In current Gutenberg
How come that one is more compatible? Looks like this is automatically solved in the customizer screen, and we should / could copy however that works to the stand alone editor as well. |
So it looks like what's happening is that SiteOrigin Widgets only listens for the This is not correct. Widgets should set up the widget when the https://plugins.trac.wordpress.org/browser/so-widgets-bundle/trunk/base/js/admin.js#L1405 Still, I think we might be able to make Legacy Widget compatible with this code by faking the edit: Oops, just realised this is almost literally what @jorgefilipecosta wrote above 😅 |
Hm, nope, this doesn't work because the plugin binds the I think that in this case it's not unreasonable to say the the plugin needs to be updated to remove the I'm warming to the argument that the Widgets screen should launch as an opt-in feature so that plugins have an opportunity to test and make these sorts of minor changes. Please keep bringing up any compatibility issues you see and I will investigate! |
I think let's close this overview/catch-all issue. The Legacy Widget block has been through a lot of iteration recently and backwards compatibility is definitely in a better state. See #31126 (comment). There are also now some docs that explain the caveats surrounding the If and when we find new backwards compatibility issues, let's open one new issue per problem. |
Describe the bug
Some widgets don't work as expected on legacy widgets block because the scripts they need are not loaded.
That happens because instead of using the widget specific functions to enqueue assents and widget may be using different methods:
I guess for some cases we may not be able to make things work and probably third party widgets will need a small change in their conditions/enqueue mechanism.
But we may try to emulate the old screen better and trick widgets into enqueuing their scrips.
I guess a method to improve here is install something like 15 very used widgets. Verify which ones don't work because their scripts are not enqueued.
Check the conditions on this widgets and see if we can make this contains be true with some "emulation".
To reproduce
Install https://wordpress.org/plugins/simple-image-widget/.
Verify the widget does not works as expected on legacy widgets because its scripts are not loaded.
The text was updated successfully, but these errors were encountered: