Consider showing block preview when hovering block in inserter
This would be a desktop-only enhancement and would be good to pair with #4102.
You'd click the inserter and get the interface you're used to:

When hovering a block, a little preview area would pop up below the inserter:

The thing we'd show here would be the block, pre-filled with some dummy content (in this case the description text). The entire preview element would then be scaled down to 75%, using something like transform: scale( .75 ).
This was an idea @mtias suggested a while back.
I really like this idea for helping people discover what a block is. Right now we are getting some strong feedback about discoverability not being great on types of blocks. I've seen in tests people 'trying out' blocks, in theory this means they don't have to.
@jasmussen I love the direction of this. Would be great to test it out and see how it feels. But my initial reaction is that this is a good idea.
@jasmussen Good idea and UI. One thing to note is it may be something that shouldn’t be required. While the core blocks are relatively simple, plugins will most definitely be introducing much more complex blocks where a preview like this could be complicated.
It would not be consistent. Third party block(s) cannot be forced to have own preview.
Thanks @jasmussen for exploring this one! The other side to this idea is that it'd be crucial for saved blocks — specially when you have more than a few, and the names alone don't cut it. Imagine having 5-10 testimonials and being able to quickly preview before inserting.
Third party block(s) cannot be forced to have own preview.
The preview would be a real render of the block with dummy data, so as long as a block can be inserted, it can be previewed.
Adding the ability to opt out of preview seems good.
Another thing that would be nice to pair with this: snapshot tests. cc @youknowriad @gziolo in case you have ideas, but if we can make the preview be the thing we also test automatically, it could make sure we are not breaking blocks.
It should be possible to pass block type to EditBlock component and shallow render it and snapshot test. I can play with that when back to from being away from desktop 😎
The data attrs should be set in a way that accomplishes both the ability to preview and the ability to test.
@mtias How would the preview scale? It would work for things that are of reasonable size, but it could break down for things that are visually larger (especially vertically) or blocks that are heavily data driven.
This could be another good reason to move the inserter inline, similar to other blocks and placeholders. Kind of like a placeholder block that in not defined yet.
- Previews are displayed inline and at real size.
- You can move the inserter block/proto-placeholder.
- Mobile friendly, always fits, no overlapping boxes.
- Could be part of the undo flow: Not what you wanted, undo and you're back to the inserter.
Edit: I tried this once in https://github.com/WordPress/gutenberg/pull/2284/files#diff-713395e403ae0725760f64d46356b7b6R16
How would the preview scale? It would work for things that are of reasonable size, but it could break down for things that are visually larger (especially vertically) or blocks that are heavily data driven.
Given that the purpose of the preview would be to just aid in recognition when looking through a bunch of blocks. Given that it would be prefilled with dummy data, and having only to serve this reminder purpose, we could not only use transform: scale( .5 ), but we could even put a maximum width and height to the container where the preview would be shown, and simply fade/crop the block preview if need be.