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

Dynamic references in theme.json are not resolved in the site editor #42890

Closed
oandregal opened this issue Aug 2, 2022 · 5 comments · Fixed by #42976
Closed

Dynamic references in theme.json are not resolved in the site editor #42890

oandregal opened this issue Aug 2, 2022 · 5 comments · Fixed by #42976
Assignees
Labels
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

@oandregal
Copy link
Member

oandregal commented Aug 2, 2022

Description

We've introduced a new mechanism to refer to a different style dynamically at #41696 which allows us to do things such as:

"styles": {
    "color": {
        "background": { "ref": "styles.color.text" },
        "text": "yellow"
    }
}

In the example, the result would be that the text and background colors are the same (yellow).

Captura de ecrã de 2022-08-02 12-29-40

While this works in the front-end it doesn't in the site editor:

  • the styles box does not render the background
  • the color tools do not render the background
  • the site editor breaks if the user tries to edit the background color
Styles Color tools Site editor
Captura de ecrã de 2022-08-02 12-28-19 Captura de ecrã de 2022-08-02 12-28-28 Captura de ecrã de 2022-08-02 12-28-36

Step-by-step reproduction instructions

  • Use TwentyTwentyTwo theme and update the styles.color values to be:
"background": { "ref": "styles.color.text" },
"text": "yellow"
  • Go to the front-end and verify that it works as expected.
  • Go to the site editor and open the Global Styles Toolbar. Click on Colors and then in the Backgound element. It'll throw an error.

Environment info

I can reproduce this is trunk.

@oandregal oandregal added [Type] Bug An existing feature does not function as intended Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Aug 2, 2022
@oandregal oandregal changed the title Dynamic references are not resolved in the site editor Dynamic references in theme.json are not resolved in the site editor Aug 2, 2022
@oandregal
Copy link
Member Author

A mechanism like this one should aim to expose the design links to the users. They need to understand where the value comes from so if they decide to "break" it it'll be a conscious decision. I ellaborated about this more at #39432 (comment)

Though a first step is just to render the proper value and make the site editor look like the front-end.

@oandregal
Copy link
Member Author

cc @scruffian

@Gierand
Copy link

Gierand commented Aug 2, 2022

A similar problem with the rendering of colors in the site editor occurs when you add root padding support in the settings.

"settings": {
   "useRootPaddingAwareAlignments": true
}

No error is generated, but no change is made during editing.

@Mamaduka
Copy link
Member

Mamaduka commented Aug 3, 2022

Oh hey, @oandregal 👋

I see that @scruffian has also created an issue for this bug - #42884. So let's close one of these.

@ndiego
Copy link
Member

ndiego commented Aug 5, 2022

A similar problem with the rendering of colors in the site editor occurs when you add root padding support in the settings.

I was able to replicate @Gierand's comment and have created an issue: #43033

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

Successfully merging a pull request may close this issue.

6 participants