Skip to content

Fix: Missing conversion from json styled variable to CSS variable #69551

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

Conversation

karthikeya-io
Copy link
Contributor

@karthikeya-io karthikeya-io commented Mar 12, 2025

What?

Closes #69477

This PR fixes a block validation error occurring when using preset-based styling, ( for some properties like border-radius), defined with CSS variables in the format var:custom|border-radius|large.

How?

  • Fix: Missing conversion from json styled variable to CSS variable

Testing Instructions

  1. Open a post or page
  2. Open the code editor and add the block with block-radius and CSS variable in the format var:custom|border-radius|large.
    Example
<!-- wp:group {"style":{"border":{"radius":"var:custom|border-radius|large"}},"backgroundColor":"brand-accent-1","layout":{"type":"constrained"}} -->
<div class="wp-block-group has-brand-accent-1-background-color has-background" style="border-radius:var(--wp--custom--border-radius--large)"><!-- wp:paragraph -->
<p>test</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->
  1. Confirm there's no block validation error

Testing Instructions for Keyboard

Same

Screenshots or screencast

Before After
ss image

Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @karthikeya-io! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Mar 12, 2025
@karthikeya-io karthikeya-io marked this pull request as ready for review March 12, 2025 18:45
Copy link

github-actions bot commented Mar 12, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @EldarAgalarov.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: EldarAgalarov.

Co-authored-by: karthikeya-io <karthikeya01@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: carolinan <poena@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Feature] Block API API that allows to express the block paradigm. labels Mar 13, 2025
@Mamaduka Mamaduka self-requested a review April 17, 2025 08:30
@Mamaduka Mamaduka added [Package] Style Engine /packages/style-engine and removed First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository labels Apr 17, 2025
Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @karthikeya-io!

The fix works as expected ✅

@Mamaduka Mamaduka added the props-bot Adding this label triggers the Props Bot workflow for a PR. label Apr 17, 2025
@github-actions github-actions bot removed the props-bot Adding this label triggers the Props Bot workflow for a PR. label Apr 17, 2025
@Mamaduka Mamaduka merged commit adc77d7 into WordPress:trunk Apr 17, 2025
74 of 75 checks passed
@github-actions github-actions bot added this to the Gutenberg 20.8 milestone Apr 17, 2025
chriszarate pushed a commit to chriszarate/gutenberg that referenced this pull request Jul 1, 2025
…rdPress#69551)

Unlinked contributors: EldarAgalarov.

Co-authored-by: karthikeya-io <karthikeya01@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: carolinan <poena@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block API API that allows to express the block paradigm. [Package] Style Engine /packages/style-engine [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pattern code with json-styled variable paths is not acceptable, producing error
2 participants