-
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
Provide an API to conditionally style the Legacy Widget preview iframe #32805
Comments
I also sympathize with this issue. When we create a widget by front
admin widget screen
In the admin panel, |
Thanks for the explanation. The Legacy Widget Preview will be loaded in an iframe for each widget area, as shown in the following URL
For example, if the widget area is in the sidebar and footer, the Legacy Widget Preview has the same URL and does not identify the widget area. |
Hi @nendeb. A tricky consideration here is that some of the blocks/widgets won't have an ID until the user presses Update. This is because IDs are computed by the server. Could an alternative be for us to add the sidebar's ID to the Widget Area container so that you can write CSS rules which style blocks differently depending on which Widget Area container they're in? *[data-type="core/widget-area"][data-id="sidebar-1"] .wp-block-legacy-widget {
...
} |
In the context of the above I think the best solution is:
|
OK the approach I described in #32805 (comment) and @draganescu implemented in #33388 won't fix this issue because any CSS in the widgets editor won't cascade into the preview iframe. We need to come up with something more comprehensive, e.g. adding the sidebar ID to the iframe URL or to the preview iframe's I think it's best if we take time to think this through properly and not rush to include a fix in 5.8. I don't want us to end up in a situation where we have to forever maintain a poorly thought out API. So, let's fix this in 5.8.1, not 5.8. I've included it in #33242 so that it gets attention. |
Widgets:Legacy Widget Preview
What problem does this address?
In my theme I have multiple widget areas, and I use CSS to change the design of each widget area, even for the same widget.
However, the widget editor, legacy-widget-preview, can't distinguish between widget areas, so I get the same design.
What is your proposed solution?
I would like the widget editor legacy-widget-preview to include widget_id in the body_class so that it can identify the widget area.
The text was updated successfully, but these errors were encountered: