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

Try: Overlay caption w. text-shadow. #63471

Merged
merged 8 commits into from
Aug 19, 2024
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 34 additions & 7 deletions packages/block-library/src/gallery/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,45 @@ figure.wp-block-gallery.has-nested-images {
width: auto;
}

// Position caption and scrim at the bottom.
&:has(figcaption)::before,
figcaption {
background: linear-gradient(0deg, rgba($color: $black, $alpha: 0.7) 0, rgba($color: $black, $alpha: 0.3) 70%, transparent);
position: absolute;
bottom: 0;
right: 0;
left: 0;
max-height: 100%;
}

// Create a background blur layer.
&:has(figcaption)::before {
content: "";
height: 100%;
max-height: 40%;

// Blur the background under the gradient scrim.
backdrop-filter: blur(3px);

// Crop the caption so the blur is only on the edge.
mask-image: linear-gradient(0deg, rgba($color: $black, $alpha: 1) 20%, rgba($color: $black, $alpha: 0) 100%);
jasmussen marked this conversation as resolved.
Show resolved Hide resolved
}

// Place the caption at the bottom.
figcaption {
color: $white;
text-shadow: 0 0 1.5px $black;
font-size: $default-font-size;
left: 0;
margin-bottom: 0;
max-height: 60%;
margin: 0;
overflow: auto;
padding: 0 8px 8px;
position: absolute;
padding: 1em;
Copy link
Contributor

@t-hamano t-hamano Aug 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a non-blocker suggestion.

Because scrollbar-gutter: stable both-edges has been applied to the figcaption, the padding on the left and right looks wider, we may want to make it a little smaller.

Below is what it looks like on my environment, but how does it look on yours?

padding: 1em:

image

padding: 1em 0.5em:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't disagree, though since this PR already touches a fair bit of CSS, I wonder if it's not best to do this separately?

Thank you again for the thorough reviews!

text-align: center;
width: 100%;
box-sizing: border-box;
@include custom-scrollbars-on-hover(transparent, rgba($white, 0.8));

// Dark gradient scrim.
//background: linear-gradient(0deg, rgba($color: $black, $alpha: 0.4) 0%, rgba($color: $black, $alpha: 0) 100%, transparent);
background: linear-gradient(0deg, rgba($color: $black, $alpha: 0.4) 0%, transparent 100%);
jasmussen marked this conversation as resolved.
Show resolved Hide resolved

img {
display: inline;
}
Expand All @@ -85,6 +108,10 @@ figure.wp-block-gallery.has-nested-images {
margin: 0;
padding: 10px 10px 9px;
position: relative;
text-shadow: none;
}
&::before {
content: none;
}
}
}
Expand Down
Loading