gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Inconsistent padding behavior when background color is applied via Inspector vs Global Styles

Open dpmehta opened this issue 7 months ago • 1 comments

Description

When applying a background color to a Paragraph block, when background color is applied via Global styles no padding is added but when background color is added via inspector controls we can observe padding is added which is inconsistent behavior.

Steps to Reproduce

  1. Add a Paragraph block with text.

Case 1 : Inspector

  1. Apply background color from block sidebar.
  2. Observe padding is added.

Case 2 : Global Styles

  1. Apply background color via Global Styles.
  2. Observe no padding is added.

Screenshots or Screencast

Image

Expected behavior

Background color styling should behave consistently regardless of whether it is applied via Global Styles or block-level controls.

Actual behavior

Padding is only applied when background color is set via block inspector, leading to inconsistent layout.

Other Notes

Other than it , this behavior which is when we add background color to paragraph block automatically adds padding as well which i feel strange behaviour because some user may want to just apply background color but user gets unnecessary padding as well. I know it is intended behaviour because i debugged and found out below code so it seems that it is intended behavior but it feels strange.

https://github.com/WordPress/gutenberg/blob/1e811c49e4ae04abd76047776cf23779cc2ccb13/packages/block-library/src/paragraph/style.scss#L43-L46

dpmehta avatar Apr 07 '26 06:04 dpmehta

Closing as a duplicate of #38141

t-hamano avatar Apr 07 '26 07:04 t-hamano