Skip to content

Commit

Permalink
Disable percentage units for Spacer
Browse files Browse the repository at this point in the history
  • Loading branch information
stacimc committed Dec 6, 2021
1 parent c63fe49 commit 36b8192
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 111 deletions.
110 changes: 0 additions & 110 deletions packages/block-library/src/common.scss

This file was deleted.

9 changes: 8 additions & 1 deletion packages/block-library/src/spacer/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,15 @@ function DimensionInput( {
const inputId = `block-spacer-height-input-${ instanceId }`;
const isPx = unit === 'px';

// In most contexts the spacer size cannot meaningfully be set to a
// percentage, since this is relative to the parent container. This
// unit is disabled from the UI.
const availableUnitSettings = useSetting( 'spacing.units' ).filter(
( availableUnit ) => availableUnit !== '%'
);

const units = useCustomUnits( {
availableUnits: useSetting( 'spacing.units' ) || [
availableUnits: availableUnitSettings || [
'px',
'em',
'rem',
Expand Down

0 comments on commit 36b8192

Please sign in to comment.