-
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
Style Book: Attempt to add margin offset for shadow values #48578
Conversation
Size Change: +545 B (0%) Total Size: 1.34 MB
ℹ️ View Unchanged
|
Flaky tests detected in 05c5e22. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4289727983
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your continued efforts on this!
On the whole I'm more inclined to the solution from #48470, with maybe a slight increase to the margin value if it helps? For two reasons:
- There's no way of knowing how big a theme might set the box-shadow value to. With 200px shadows, the style book starts looking a little too spaced out:
- If we ever add other style controls that don't take up width, e.g. outline, we'll have to measure multiple properties instead of one, which will quickly become unmaintainable. (For that matter, there's no way of knowing what custom CSS might be added for any block, which will also appear in the style book, so there's always a chance things will look broken)
Thanks so much for taking this for a spin @tellthemachines, I know it's a bit of a weird PR! 😄
Great arguments 👍 |
That sounds good! With the other potential advantage that if we're not iframing each individual block, those previews might load faster 😅 |
I'll close out this particular PR in favour of the exploration of a root-level (to the style book) iframe over in #48664 |
What?
Fixes: #48392 (potentially)
This is an alternative PR to #48470 that seeks to fix the issue where shadows are cut off within the Style Book previews by parsing any shadow values set on the blocks within the preview, and adding a margin as an offset.
Where #48470 attempted to fix the issue by adding a small margin across the board, it had the limitation that larger shadows would still get cut-off. The trade-off of this PR is that while it attempts to extract the real shadow values and calculate a margin to accomodate, it's more complex, and potentially adds code that we might wish to avoid including.
Why?
As raised in reviews for #48470, the approach there didn't resolve the issue for larger shadows. This PR seeks to explore whether or not it's worth it to try a more complex solution.
How?
8px
and a blur radius of50px
then its right and bottom values should be58px
.Testing Instructions
A question for the reviewer: is the approach in this PR appropriate, or too heavy-handed? Also, does the logic need tweaking?
Screenshots or screencast