Skip to content

Commit

Permalink
Fix unlabeled Spacer block controls (#63806)
Browse files Browse the repository at this point in the history
* Fix missing label for horizontal spacer.

* Remove unnecessary BaseControl.

* Add missing label to SpacingInputControl RangeControl.

* Hide label from vision.

* Use 40px size for the Unit control.

* Try grid layout for the single unit control.

* Remove Grid experiment and show single unit control full width.

* Restore conditional that was changed for testing purposes.

Co-authored-by: afercia <[email protected]>
Co-authored-by: tyxla <[email protected]>
Co-authored-by: mirka <[email protected]>
Co-authored-by: joedolson <[email protected]>
  • Loading branch information
5 people authored Jul 26, 2024
1 parent e98f358 commit eea7183
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ function FlexControls( {
} );
} }
value={ flexSize }
label={ flexResetLabel }
hideLabelFromVision
/>
) }
</VStack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ export default function SpacingInputControl( {
onChange={ handleCustomValueSliderChange }
className="spacing-sizes-control__custom-value-range"
__nextHasNoMarginBottom
label={ ariaLabel }
hideLabelFromVision
/>
</>
) }
Expand Down
23 changes: 10 additions & 13 deletions packages/block-library/src/spacer/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
privateApis as blockEditorPrivateApis,
} from '@wordpress/block-editor';
import {
BaseControl,
PanelBody,
__experimentalUseCustomUnits as useCustomUnits,
__experimentalUnitControl as UnitControl,
Expand Down Expand Up @@ -57,19 +56,17 @@ function DimensionInput( { label, onChange, isResizing, value = '' } ) {
return (
<>
{ ( ! spacingSizes || spacingSizes?.length === 0 ) && (
<BaseControl label={ label } id={ inputId }>
<UnitControl
id={ inputId }
isResetValueOnUnitChange
min={ MIN_SPACER_SIZE }
onChange={ handleOnChange }
style={ { maxWidth: 80 } }
value={ computedValue }
units={ units }
/>
</BaseControl>
<UnitControl
id={ inputId }
isResetValueOnUnitChange
min={ MIN_SPACER_SIZE }
onChange={ handleOnChange }
value={ computedValue }
units={ units }
label={ label }
__next40pxDefaultSize
/>
) }

{ spacingSizes?.length > 0 && (
<View className="tools-panel-item-spacing">
<SpacingSizesControl
Expand Down

0 comments on commit eea7183

Please sign in to comment.