Skip to content

Commit

Permalink
Apply negative value to margins with a calc so clamp values behave co…
Browse files Browse the repository at this point in the history
…rrectly (#44718)
  • Loading branch information
glendaviesnz authored and ockham committed Oct 10, 2022
1 parent 8c0c1a5 commit 55b78ec
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/block-editor/src/hooks/margin.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,10 @@ export function MarginVisualizer( { clientId, attributes } ) {
borderRightWidth: marginRight,
borderBottomWidth: marginBottom,
borderLeftWidth: marginLeft,
top: marginTop !== 0 ? `-${ marginTop }` : 0,
right: marginRight !== 0 ? `-${ marginRight }` : 0,
bottom: marginBottom !== 0 ? `-${ marginBottom }` : 0,
left: marginLeft !== 0 ? `-${ marginLeft }` : 0,
top: marginTop !== 0 ? `calc(${ marginTop } * -1)` : 0,
right: marginRight !== 0 ? `calc(${ marginRight } * -1)` : 0,
bottom: marginBottom !== 0 ? `calc(${ marginBottom } * -1)` : 0,
left: marginLeft !== 0 ? `calc(${ marginLeft } * -1)` : 0,
};
}, [ margin ] );

Expand Down

0 comments on commit 55b78ec

Please sign in to comment.