You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@aaronrobertshaw@andrewserong@ramonjd, based on my understanding, I suspect that the initial implementation of the radius presets does not allow for complex CSS values. Is it possible to support values that include the clamp function, similar to the spacingSizes preset?
I'll defer to @aaronrobertshaw but I'm not sure it can work the same way as spacing because of corners?
From what I've debugged however, it's because the presetIndex is undefined for clamp|min|... values because getPresetValueFromCustomValue is trying to parse value + pixel values.
When parseQuantityAndUnitFromRawValue can't parse a clamp value like "clamp(1rem, 2vw, 3rem)", it returns [undefined, undefined],
The following diff fixes it I think
With the fix, if the original value is a string and parsing fails, we return [value, ''], preserving the clamp value.
This ensures clamp values flow through getAllValue → getPresetValueFromCustomValue → the component state, so they aren't lost when converting between presets and custom values.
I left a comment wondering if we should try to check for valid values rather than letting the string through, but sanitization is probably happening in the backend anyway.
diff --git a/packages/block-editor/src/components/border-radius-control/utils.js b/packages/block-editor/src/components/border-radius-control/utils.js
index ad39ebdf0a..9b6b56e2a0 100644
--- a/packages/block-editor/src/components/border-radius-control/utils.js+++ b/packages/block-editor/src/components/border-radius-control/utils.js@@ -60,9 +60,14 @@ export function getAllValue( values = {} ) {
return values;
}
- const parsedQuantitiesAndUnits = Object.values( values ).map( ( value ) =>- parseQuantityAndUnitFromRawValue( value )- );+ const parsedQuantitiesAndUnits = Object.values( values ).map( ( value ) => {+ const newValue = parseQuantityAndUnitFromRawValue( value );+ if ( typeof value === 'string' && newValue[ 0 ] === undefined ) {+ // Should we do some string testing here, like the font size picker's `isSimpleCssValue`?+ return [ value, '' ];+ }+ return newValue;+ } );
const allValues = parsedQuantitiesAndUnits.map(
( value ) => value[ 0 ] ?? ''
Activity
t-hamano commentedon Nov 6, 2025
Thanks for the report. The radius preset is a new feature added in the 6.9 release, so let's try fixing it in the 6.9 release.
t-hamano commentedon Nov 6, 2025
@aaronrobertshaw @andrewserong @ramonjd, based on my understanding, I suspect that the initial implementation of the radius presets does not allow for complex CSS values. Is it possible to support values that include the clamp function, similar to the
spacingSizespreset?ramonjd commentedon Nov 6, 2025
I'll defer to @aaronrobertshaw but I'm not sure it can work the same way as spacing because of corners?
From what I've debugged however, it's because the
presetIndexisundefinedforclamp|min|...values becausegetPresetValueFromCustomValueis trying to parsevalue + pixelvalues.When
parseQuantityAndUnitFromRawValuecan't parse a clamp value like"clamp(1rem, 2vw, 3rem)", it returns[undefined, undefined],The following diff fixes it I think
With the fix, if the original value is a string and parsing fails, we return
[value, ''], preserving the clamp value.This ensures clamp values flow through
getAllValue → getPresetValueFromCustomValue → the component state, so they aren't lost when converting between presets and custom values.I left a comment wondering if we should try to check for valid values rather than letting the string through, but sanitization is probably happening in the backend anyway.
ramonjd commentedon Nov 6, 2025
I added a PR to test that patch here: