WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.25k stars 4.09k forks source link

Paragraph block margin left and right is not working properly #62142

Open pitamdey opened 2 months ago

pitamdey commented 2 months ago

Description

The Paragraph block margins left and right are not working properly In inspect, I can see the style is not implemented and the default margin left and right are applied which is marked with important

Step-by-step reproduction instructions

  1. Add Paragraph Block
  2. Change the Margin left and Right
  3. The changes are not getting reflected

Screenshots, screen recording, code snippet

https://www.loom.com/share/5d74674695fa41f8b50fecf986e5c2ba?sid=ae39c25b-d352-4879-801f-1de35bc48410

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

talldan commented 2 months ago

I think this is expected currently, as the margin for the block alignments (usually auto margin) has to take precedence for the content to stay nicely aligned. (cc @andrewserong and @tellthemachines who know more than I about this)

It is unfortunate that the UI creates the expectation that it can be changed. I wonder if there's anything that can be done about that.

andrewserong commented 2 months ago

Yes, I think your comment captures it nicely. There's an inherent tension between layout styles that are designed to restrict (or constrain) content in some way, and the dimensions tools. Making the UI aware enough of that context to be either disabled or show a warning for margin, could be a path forward there?

If folks are looking for a workaround, you can wrap a paragraph in a Group block, and then toggle off the Inner blocks use content width setting on the group block, and that will get the left and right margins of the child paragraph block working. Just thought I'd mention that in case it helps anyone working on content right now.