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

Site Editor: is-dark-theme class is not applied correctly #49294

Closed
t-hamano opened this issue Mar 23, 2023 · 1 comment
Closed

Site Editor: is-dark-theme class is not applied correctly #49294

t-hamano opened this issue Mar 23, 2023 · 1 comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended

Comments

@t-hamano
Copy link
Contributor

t-hamano commented Mar 23, 2023

Description

The block editor determines if it is a dark theme based on the canvas background color via useDarkThemeBodyClassName and grants the is-dark-theme class. However, when changing the background color from the global style or changing the theme variation, the previous background color is referenced and this class is not given correctly.

As a result, components that depend on this class will not be displayed in the correct color.

Step-by-step reproduction instructions

  • Open the site editor.
  • Make sure that the .is-dark-theme class is not added to the body tag in the iframe.
  • Insert a spacer block in one of the templates.
  • Confirm that the background color changes to gray when the spacer block is selected. This is the style for non-dark themes.

non_dark_theme_valid

  • From the Global Style menu, apply black to the background color.
  • Confirm that the .is-dark-theme class is not added to the body tag, even though it is considered a dark theme.

dark_theme_invalid

  • Reset the background color from the global style menu.
  • The .is-dark-theme class is unintentionally added to the body tag. As a result, the background color for the dark theme is applied to the spacer block, making it invisible.

non_dark_theme_invalid

@t-hamano t-hamano added Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") labels Mar 23, 2023
@jordesign jordesign added the [Type] Bug An existing feature does not function as intended label Jul 26, 2023
@t-hamano
Copy link
Contributor Author

This issue will not be reproduced in the latest Gutenberg and will be closed. Instead, it appears that a similar issue is occurring in the post editor: #60299

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") Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants