Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions packages/block-library/src/spacer/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ function DimensionInput( { label, onChange, isResizing, value = '' } ) {
defaultValues: { px: 100, em: 10, rem: 10, vw: 10, vh: 25 },
} );

const handleOnChange = ( unprocessedValue ) => {
onChange( unprocessedValue.all );
};
Comment on lines -47 to -49
Copy link
Contributor Author

@stokesman stokesman Jan 22, 2025

Choose a reason for hiding this comment

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

This handler creates a bug if used with both controls. There is no all property on the value passed by UnitControl. This would appear to have been an issue since #44002 though nullified since #61842.


// Force the unit to update to `px` when the Spacer is being resized.
const [ parsedQuantity, parsedUnit ] =
parseQuantityAndUnitFromRawValue( value );
Expand All @@ -57,23 +53,24 @@ function DimensionInput( { label, onChange, isResizing, value = '' } ) {

return (
<>
{ ( ! spacingSizes || spacingSizes?.length === 0 ) && (
{ spacingSizes?.length < 2 ? (
<UnitControl
id={ inputId }
isResetValueOnUnitChange
min={ MIN_SPACER_SIZE }
onChange={ handleOnChange }
onChange={ onChange }
value={ computedValue }
units={ units }
label={ label }
__next40pxDefaultSize
/>
) }
{ spacingSizes?.length > 0 && (
) : (
<View className="tools-panel-item-spacing">
<SpacingSizesControl
values={ { all: computedValue } }
onChange={ handleOnChange }
onChange={ ( { all } ) => {
onChange( all );
} }
label={ label }
sides={ [ 'all' ] }
units={ units }
Expand Down
Loading