gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Feature request: Allow negative margins in controls

Open carolinan opened this issue 3 years ago • 32 comments

What problem does this address?

It is not possible to use negative margins in the margin control.

What is your proposed solution?

If negative margins were allowed, designers could overlap blocks easier without having to create custom block styles. This would also open up for more varied block patterns -the block pattern directory can not use custom block styles.

carolinan avatar Jun 12 '21 07:06 carolinan

Actually you can do it by passing min prop. for ex.

<BoxControl
    label={__('Margin')}
    onChange={(value) => console.log(value)}
    inputProps={{ min: -300 }}
/>

It is not explained in Readme but i can able to find it when searching inside core files

thirumani02 avatar Aug 10 '21 06:08 thirumani02

Does anyone know if there are plans to implement this? Negative margins are a very common and useful layout tool that seems should be enabled by default for the core margin control.

timsinc avatar Jan 17 '22 16:01 timsinc

Hallo! Trying to work with FSE and this is a serious serious oversight. We need to be able to set negative margins, it's a very common technique.

aurooba avatar Jan 23 '22 23:01 aurooba

I am not sure how this would affect the blockgap?

carolinan avatar Feb 07 '22 09:02 carolinan

+1 to adding negative margins. I just found a case in the wild where this would have been very useful.

mrfoxtalbot avatar Feb 07 '22 12:02 mrfoxtalbot

I am not sure how this would affect the blockgap?

I believe a negative margin value would affect the blockgap just like a positive margin does and override the blockgap css for that particular block.

timsinc avatar Feb 07 '22 15:02 timsinc

+1

Negative margin is essential for design and layout building

daviedR avatar Feb 08 '22 01:02 daviedR

+1

Negative margin allowing for overlapping elements is essential.

samxmunoz avatar Apr 12 '22 17:04 samxmunoz

+1

I need it for a design I'm currently building.

rolf-yoast avatar Apr 13 '22 05:04 rolf-yoast

Reopening this one because #40464 is getting reverted.

aristath avatar Apr 28 '22 07:04 aristath

+1 Negative values for spacing fields. Essential for layout building.

AdsonCicilioti avatar May 31 '22 03:05 AdsonCicilioti

+1 Negative values for spacing fields. Essential for layout building.

jonathanelmgren avatar Jun 02 '22 09:06 jonathanelmgren

+1 Negative values are essential for building layouts.

peiche avatar Jun 28 '22 16:06 peiche

+1 Negative values are essential for building layouts (with z-index in the blocks).

diegosomar avatar Jul 10 '22 21:07 diegosomar

+1 Instead of allowing unlimited, how about allowing -20?

nendeb avatar Aug 28 '22 06:08 nendeb

+1

The is essential to designing layouts, the recent revert broke a few sites of mine.

namithj avatar Sep 05 '22 15:09 namithj

+1 Instead of allowing unlimited, how about allowing -20?

This might be possible by using "spacing presets" in theme.json. I have not tested it.

carolinan avatar Sep 06 '22 06:09 carolinan

This might be possible by using "spacing presets" in theme.json. I have not tested it.

Where can I find the specific code?

nendeb avatar Sep 08 '22 01:09 nendeb

https://github.com/WordPress/gutenberg/pull/41527

carolinan avatar Sep 08 '22 06:09 carolinan

#41527

Thanks. This is supposed to define a negative set value.

--wp-priset--spacing-size--minus1: -1 --wp-priset--spacing-size--minus2: -2 --wp-priset--spacing-size--minus3: -3 . . .

Before testing. I don't think this is a very good way to do it if

nendeb avatar Sep 08 '22 07:09 nendeb

This is definitely needed. I was trying to show a client how to add margins to a block and could not add negative margins when they asked about overlapping a block on top of another. This is a limitation for block themes in being able to achieve certain layouts

rxnlabs avatar Sep 11 '22 14:09 rxnlabs

@nendeb that will work, however the scale is also applied to padding. We really need support for negative values on margin inputs, it's a huge limitation for designers.

seothemes avatar Sep 17 '22 02:09 seothemes

please give the freedom over negative values to the users NOW 👍

nicmare avatar Sep 26 '22 09:09 nicmare

There is a workaround to allow negative margins, but without responsive controls they may not be the answer.

Please see https://github.com/WordPress/gutenberg/pull/40464#issuecomment-1260263890

seothemes avatar Sep 28 '22 01:09 seothemes

+1 Negative values

bnjunge avatar Oct 05 '22 19:10 bnjunge

+1 NEGATIVE MARGINS MUST GO ON!!

dimasoho avatar Nov 21 '22 16:11 dimasoho

+1 negative values for margins to realize an outfit like this: image

hagege avatar Nov 23 '22 11:11 hagege

I also need it.... please...

flipflap avatar Dec 04 '22 10:12 flipflap

+1 for negative margins I built a block that sometimes needs to overlap the block below it or above it for the design, yet after implementing I have found that it doesn't support negative. We will have to build a manual workaround which is not ideal.

websitegenii avatar Jan 23 '23 17:01 websitegenii

Hard to believe we're approaching this issue being 2 years old, and it still isn't implemented yet. It's an essential feature.

dmpinder avatar Jan 30 '23 15:01 dmpinder