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

Block Styles: Show style preview when hovered or focused #33933

Closed
Tracked by #33447
shaunandrews opened this issue Aug 6, 2021 · 7 comments · Fixed by #34522
Closed
Tracked by #33447

Block Styles: Show style preview when hovered or focused #33933

shaunandrews opened this issue Aug 6, 2021 · 7 comments · Fixed by #34522
Assignees
Labels
[Feature] Style Variations Related to style variations provided by block themes [Type] Task Issues or PRs that have been broken down into an individual action to take

Comments

@shaunandrews
Copy link
Contributor

image

Block Styles appear in both the block's toolbar and in the editor's sidebar. Currently, styles are shown with both a rendered preview and a name. The previews are a little too small to be helpful, but also add to the overall height of the sidebar accordion. Here's how it look when a plugin adds just a few styles to the Button block:

image

The overall height of the accordion in the screenshot above is about 570px. It ends up pushing down more important controls like Typography and Color.

Lets move the previews so they only appear when the style is hovered or has keyboard focus. This reduces the overall footprint, and also puts more emphasis on the style's name.

Style Previews on Hover

@shaunandrews shaunandrews added Needs Design Feedback Needs general design feedback. [Feature] Style Variations Related to style variations provided by block themes labels Aug 6, 2021
@fwazeter
Copy link
Member

fwazeter commented Aug 7, 2021

I like the way this feels - it appears more functional while also feeling a bit more modern when handling the preview.

@richtabor
Copy link
Member

I agree. This makes styles still be featured - but take up a lot less space in the sidebar.

@mtias mtias added [Type] Task Issues or PRs that have been broken down into an individual action to take and removed Needs Design Feedback Needs general design feedback. labels Aug 30, 2021
@mtias mtias mentioned this issue Aug 30, 2021
65 tasks
@ramonjd
Copy link
Member

ramonjd commented Sep 1, 2021

I tried this out using a Popover. I had to rely on a Popover SlotFill at the outer, Post Editor level since the sidebar hides any overflow.

Screen Capture on 2021-09-01 at 11-08-21

On mouseover, rendering the preview is not entirely reliable as you can see from the screen capture above.

Often there's not enough time for the preview container to calculate the correct height, something it does on the fly. My guess the Popover animation and the bevy of nested iframes don't help much.

Still, this happens sometimes in the block inserter previews as well.

Also, for mobile (and if the popovers prove too unruly/inaccessible) I thought maybe we could reduce the preview to the currently selected (no previews)

styes-mobile-batman

Also were there any preferences for the Default Style dropdown?

Thanks!

@mtias
Copy link
Member

mtias commented Sep 8, 2021

One thing that stands out in terms of componetry — because this is a design pattern we don't have anywhere else — is that it looks fairly aligned with the new proposal for font pair selection in global styles:

image

It might be good to be explicit about aligning there in terms of component semantics.

@mtias
Copy link
Member

mtias commented Sep 8, 2021

@shaunandrews have you thought about the "default style" dropdown and how it'd fit? It's even more pronounced now with the smaller footprint of the style selectors and seems off. Might make sense to think of a panel ellipsis menu to handle reset and setting a new default instead, like "set current option as default".

@ramonjd ramonjd self-assigned this Nov 2, 2021
@apeatling
Copy link
Contributor

Worked on in #34522

@shaunandrews
Copy link
Contributor Author

Using the more menu could help with resetting and changing the default style:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Style Variations Related to style variations provided by block themes [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

6 participants