Extra Sidebar Widgets: CSS no longer enqueued on Elementor pages including a widget #39813
Labels
[Feature] Extra Sidebar Widgets
[Focus] Compatibility
Ensuring our products play well with third-parties
[Platform] Atomic
[Plugin] Jetpack
Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/
[Pri] Normal
[Status] In Progress
Triaged
[Type] Bug
When a feature is broken and / or not performing as intended
Impacted plugin
Jetpack
Quick summary
This is a long-standing issue with the Elementor plugin. I reported it here: elementor/elementor#29010
However, until #39518 this was a bug that was not noticeable since we enqueued all the CSS on all pages with the concatenated
jetpack.css
file. Now that we rely on each individual CSS file being enqueued, we're starting to notice the issue.Plugins can register WordPress widgets using the Widgets API (
register_widget
and extending theWP_Widget
class). When they do that, they can enqueue scripts and styles for their widget, by hookingwp_enqueue_scripts
. A good practice when enqueuing custom scripts and styles is to only enqueue them when the widget is present on the page. That can be checked with theis_active_widget
feature. Unfortunately,is_active_widget
does not returntrue
on pages where a widget has been added to the page via the Elementor editor.Steps to reproduce
A clear and concise description of what you expected to happen.
I would expect the
top-posts/style.css
stylesheet to be enqueued on the page.What actually happened
It is not.
Impact
Some (< 50%)
Available workarounds?
Yes, easy to implement
If the above answer is "Yes...", outline the workaround.
As a work-around, one can manually copy and paste the widget's CSS from this file into WordPress CSS editor.
Platform (Simple and/or Atomic)
Atomic, Self-hosted
Logs or notes
This was reported here:
https://wordpress.org/support/topic/grid-layout-doesnt-work-in-the-top-posts-and-pages-widget/
The text was updated successfully, but these errors were encountered: