Change Background color of paragraph block has different effect in styles and page-editor
Description
Test with 5.9-RC3 and Twenty Twenty-Two: Asigning a background color in Styles => Blocks => Paragraph works Asigning a background color in Pages => Edit => Paragraph works But the result in the created webpage is different (see attached screenshot)
as reported in Core Trac: https://core.trac.wordpress.org/ticket/54865

Step-by-step reproduction instructions
see description above
Screenshots, screen recording, code snippet
No response
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
This is still present in WP6.3.
When a background is added in the page editor the paragraph receives additional style classes, including .has-background.
This then applies the style:
p.has-background {
padding: 1.25em 2.375em;
}
But when adding the background through global styles - no additional classes are added to the element.
Here i want to confirm one point that how we should resolve this issue , we should match behaviour with Global styling that is padding is not added when background color is applied or we should remove addition of padding when background color is applied from Inspector Controls.
cc : @mikachan
Thanks for the ping! I think my preference here would be to ensure the has-background class, which adds the padding, is added to any element that has a background colour. So it looks like we need to add this class when the background is applied via Global Styles.
My preference here would be to stop adding has-background class and instead apply a non 0 padding on the UI when the user picks a background on a block that has no padding. That way things stay simple and consistent:
- Background applies just background
- Padding applies just padding.
- The "smart behavior" is just a UX affordance you can reset.