Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only apply relative positioning to Group blocks that have negative margin applied. #64276

Open
eric-michel opened this issue Aug 5, 2024 · 1 comment
Labels
[Type] Enhancement A suggestion for improvement.

Comments

@eric-michel
Copy link

What problem does this address?

In the last major WP release, all Group blocks (with constrained layout) are given relative positioning. According to the SCSS file, that's because negative margins require it: https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/group/style.scss.

This has broken a couple of our sites by changing the relative parent of some absolute positioned elements. Our theme settings do not even allow for negative margins. In general, it just doesn't seem like good practice to set all containers to relative positioning. This removes a ton of flexibility.

On a broader note, this is another of many examples of over-aggressive CSS changes that unnecessarily break sites and impose a maintenance burden on theme and site developers. Dealing with negative margins could have been dealt with in a way that did not set all Group blocks site-wide to relative positioning. I should not have to worry about the relative parent of my absolute positioned elements spontaneously changing after a WP update.

What is your proposed solution?

Use the style engine to limit relative positioning to Group blocks that actually need it for negative margin handling.

@eric-michel
Copy link
Author

A little extra context for this issue - @aaronrobertshaw pointed out that the PR for this change included a lot of discussion about adding this relative positioning across all Group blocks. You can find that PR here: #60347.

I have not had a chance to read through all of that conversation. Had I known that PR was in the works before 6.6 released, I would definitely have objected to such an aggressive change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

1 participant