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

Disable duotone until media is provided in Cover block #54451

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

jrtashjian
Copy link
Contributor

What?

Within the Duotone control hook, assess specific blocks (cover and image) and associated media attributes to determine whether Duotone block controls should be displayed. It's worth noting that, since this feature is enabled through block.json, there's no known method for other blocks to conditionally render these controls in a similar manner.

Why?

Resolves #48804

How?

By looking at the block name and the media attributes we know.

Even though this works for now, it might not work well in the future. Media attributes can vary a lot and aren't standardized, making it tricky to set conditions.

Screenshots or screencast

New cover block
Screenshot 2023-09-14 at 00-32-16 Edit Page “Sample Page” ‹ gutenberg — WordPress

Cover block with useFeaturedImage
Screenshot 2023-09-14 at 00-32-36 Edit Page “Sample Page” ‹ gutenberg — WordPress

Cover block with media id
Screenshot 2023-09-14 at 00-32-54 Edit Page “Sample Page” ‹ gutenberg — WordPress

Cover block with overlay color only
Screenshot 2023-09-14 at 00-33-11 Edit Page “Sample Page” ‹ gutenberg — WordPress

New image block
Screenshot 2023-09-14 at 00-33-30 Edit Page “Sample Page” ‹ gutenberg — WordPress

Image block with media id
Screenshot 2023-09-14 at 00-33-46 Edit Page “Sample Page” ‹ gutenberg — WordPress

@Mamaduka Mamaduka added [Type] Enhancement A suggestion for improvement. [Feature] Media Anything that impacts the experience of managing media labels Sep 14, 2023
@ajlende
Copy link
Contributor

ajlende commented Nov 21, 2023

The image block has a visual placeholder when the block isn't selected. It's useful to set the duotone filter before adding an image for patterns. The same thing exists for previewing borders on the placeholder.

Instead of disabling duotone, could we provide a better placeholder for the cover block like we have for the image block?

There's still the problem of having a color/gradient background with a duotone filter that does nothing. But I think a satisfactory solution for that would be simply clearing the duotone filter when a color/gradient background is selected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Media Anything that impacts the experience of managing media [Type] Enhancement A suggestion for improvement.
3 participants