[wp-trac] [WordPress Trac] #63205: Gutenberg component CustomGradientPicker fails to parse theme.json gradients using size keywords (e.g., closest-side) (already fixed upstream, needs package update)

WordPress Trac noreply at wordpress.org
Mon Mar 31 21:22:19 UTC 2025


#63205: Gutenberg component CustomGradientPicker fails to parse theme.json
gradients using size keywords (e.g., closest-side) (already fixed upstream,
needs package update)
--------------------------------+-----------------------------
 Reporter:  figureone           |      Owner:  (none)
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  External Libraries  |    Version:  trunk
 Severity:  normal              |   Keywords:
  Focuses:                      |
--------------------------------+-----------------------------
 Note: this bug has been fixed in the upstream package, see below.

 Reproduce this issue by adding a custom gradient to the active theme.json
 (settings.color.gradients) that uses a size keyword, e.g.:

         {
                 "gradient": "radial-gradient(closest-side at 15% 20%, red,
 blue)",
                 "name": "Red to Blue",
                 "slug": "red-to-blue"
         }
 https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/radial-
 gradient#size

 When choosing this gradient (e.g., as a background for a Group block), the
 gradient will render properly, but the picker subcomponents (type, angle,
 linear picker) will not populate and the javascript console will log an
 error:
 `wp.components.CustomGradientPicker failed to parse the gradient with
 error Error: -side at 15% 20%, red, blue): Missing )`
 The parser captures the first portion of the size keyword as a named color
 entity.

 This bug is actually fixed in version 1.0.0 of the third party library
 gradient-parser:
 https://github.com/rafaelcaricio/gradient-
 parser/commit/d0e6c246160e21f6615c6e16e2e5e99e5f4eb93c
 https://github.com/rafaelcaricio/gradient-parser/compare/0.1.5...1.0.0

 But WordPress has the version pinned to 0.1.5:
 https://github.com/WordPress/gutenberg/blob/trunk/packages/components/package.json#L71

 Requesting updating the library version to fix this bug. Latest version of
 the dependency is 1.0.2:
 https://www.npmjs.com/package/gradient-parser

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63205>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list