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

When previewing themes the style of the widgets don't match #32629

Closed
draganescu opened this issue Jun 11, 2021 · 13 comments
Closed

When previewing themes the style of the widgets don't match #32629

draganescu opened this issue Jun 11, 2021 · 13 comments
Labels
[Feature] Widgets Customizer Ability to add and edit blocks in Customize → Widgets. [Type] Bug An existing feature does not function as intended

Comments

@draganescu
Copy link
Contributor

draganescu commented Jun 11, 2021

When previewing themes using the Customizer the style of the widgets in the widgets editor sidebar is the one of the currently active theme.

To reproduce:

  1. Have WordPress 5.8 and latest Gutenberg
  2. Have TwentyTwenty and TwentyTwentyOne installed
  3. Set TwentyTwentyOne as active
  4. Go to Appearance > Customize
  5. From the top bar of the Customizer header choose Previewing theme > Change
  6. Pick Installed themes
  7. For TwentyTwenty click Live Preview
  8. After the preview is complete go to Widgets

Expected behavior:

The styles should match

Screenshot

style-mismatch

@draganescu draganescu added [Type] Bug An existing feature does not function as intended [Feature] Widgets Customizer Ability to add and edit blocks in Customize → Widgets. labels Jun 11, 2021
@noisysocks
Copy link
Member

What precisely do you mean by "they should match". Is this a dupe of #26163?

@noisysocks noisysocks added the [Status] Needs More Info Follow-up required in order to be actionable. label Jun 16, 2021
@draganescu
Copy link
Contributor Author

It's not a dupe I believe. The problem here is that the editor in the Customizer styles the widgets and blocks to match the active theme not the one being previewed. If we eventually drop editor styles from the Widgets editor, hence the Customizer as well, then this issue won't exist anymore.

@draganescu draganescu removed the [Status] Needs More Info Follow-up required in order to be actionable. label Jun 17, 2021
@noisysocks
Copy link
Member

Ah, I see! The problem is that the Legacy Widget block preview renders using the site's active theme and not the theme being previewed in the current changeset. Thanks for clarifying.

@noisysocks noisysocks added the [Block] Legacy Widget Affects the Legacy Widget Block - used for displaying Classic Widgets label Jun 23, 2021
@noisysocks
Copy link
Member

I wonder if we should disable the Legacy Widgets "preview mode" in the Customizer. It's not very useful because there is already a preview on the right hand side, and it's confusing that the two previews look different. What do you think, @critterverse?

@noisysocks noisysocks added this to the WordPress 5.8.1 milestone Aug 30, 2021
@critterverse
Copy link
Contributor

I wonder if we should disable the Legacy Widgets "preview mode" in the Customizer.

Could we disable preview mode only when live previewing a different theme? I'm not opposed to making that change universally, just curious what the other possibilities are.

@noisysocks
Copy link
Member

We most certainly could!

@draganescu
Copy link
Contributor Author

draganescu commented Aug 31, 2021

I have heard (but unfortunately did not bookmark) others suggesting the same as an UX improvement for the customizer.

@draganescu
Copy link
Contributor Author

@noisysocks even if we disable legacy preview mode this is not solved since my testing appears to be using a search block, not some legacy widget. The block editor needs to reload its CSS when we preview another theme. I have no idea if this can be done on the fly.

@noisysocks
Copy link
Member

Right. So in the original comment's screenshot, that's a Search block and not a Legacy Widget block? And you would expect the search button to appear red, not black?

@noisysocks
Copy link
Member

Related: #33264

@draganescu
Copy link
Contributor Author

So in the original comment's screenshot, that's a Search block and not a Legacy Widget block? And you would expect the search button to appear red, not black?

Yes.

@noisysocks noisysocks removed the [Block] Legacy Widget Affects the Legacy Widget Block - used for displaying Classic Widgets label Feb 17, 2022
@noisysocks
Copy link
Member

Got it 😀 thanks for clarifying. I mistakenly thought this was about the Legacy Widget block.

So, this happens by design. We don't load editor styles in the Customizer widgets block editor (that is: it's equivalent to turning Use theme styles off in the post block editor preferences) because there is already a preview of what the content will look like on the right hand side of the screen. Maybe it's something we'll revisit in the future but for now this is working as expected.

@draganescu
Copy link
Contributor Author

Yes, excellent, I believe the problem was found when we did load the styles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Widgets Customizer Ability to add and edit blocks in Customize → Widgets. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

4 participants