-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
ZStack being absolutely positioned makes it hard to center and size #51807
Comments
Hey there 👋 Setting the |
@ciampo Ah! Look at that. You're right, although then it requires you to make the |
@justgage I wasn't around when the Your points makes sense, though! I think I may be able to rewrite the component using CSS grid, so that the final "visual" result doesn't change, but allowing the component's bounding box to reflect more closely the actual space taken by the component. |
Opened #51836, I'll try to prep for review by EOD |
Description
When working on Day One Web, we're trying to use ZStack to stack avatars, but it's troublesome due to the absolute positioning. Absolute positioning is problematic because it no longer dynamically takes up space in the DOM and can't be as quickly centered with Flexbox.
I'm curious if we can't use a negative margin instead of absolute positioning, and you can still get the proper layering by using a big of a hack with
position: relative
(see below) : https://codepen.io/justgage/pen/GRwjPZP(in case the codepen dies, here's the code)
Screen.Recording.2023-06-22.at.7.43.02.AM.mov
Step-by-step reproduction instructions
Here's a code example of something we were trying to do (simplified a bit)
Screenshots, screen recording, code snippet
Here you can see this is even happening in the storybook if you wrap an element around it:
Environment info
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
The text was updated successfully, but these errors were encountered: