WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.32k stars 4.12k forks source link

List view: Show placeholder material when a block is in placeholder state #64531

Open jasmussen opened 1 month ago

jasmussen commented 1 month ago

When an image block is in a placeholder state, it shows a literal gray-with-diagonal-line placeholder material to indicate what it is. Shown here, an image, and a placeholder image:

image and placeholder

In the list view, images have little thumbnails that show up next to them:

List view before

Because images in a placeholder state are not that useful, it might be useful to further highlight that, by showing the same placeholder material for blocks in said state:

List view after

@WordPress/gutenberg-design

hanneslsm commented 1 month ago

One argument against adding a placeholder thumbnail in the list view is that blocks without content are not rendered on the front end. I feel like adding a thumbnail would not differentiate the block enough from ones that have content. However, additionally the Image Block (and any other blocks without content) could be greyed out in the list view to indicate that they need to be filled.

richtabor commented 1 month ago

One argument against adding a placeholder thumbnail in the list view is that blocks without content are not rendered on the front end.

I wonder if there should be a condition where image blocks without images do render on the front-end. Like if there's an aspect ratio, or a hidden attribute. That way you could share designs with folks, even without imagery.

However, additionally the Image Block (and any other blocks without content) could be greyed out in the list view to indicate that they need to be filled.

But then it may just as well feel disabled, indicating you can't upload an image.

jasmussen commented 1 month ago

I wonder if there should be a condition where image blocks without images do render on the front-end. Like if there's an aspect ratio, or a hidden attribute. That way you could share designs with folks, even without imagery.

Would that be a prerequisite for this issue, you think? And it sounds useful to me. Can even be something like <img data-is-placeholder alt="" [...] />, with a special CSS style for the empty image.