Add visible labels to BlockPatternPicker pattern selection buttons#19789
Conversation
6a89114 to
263cbe9
Compare
|
I would appreciate some help from designers. I have trouble doing it myself, mostly because of the fact that in the mock-ups the label is outside of the button. Ideally, both the icon and label should be wrapped with the Button component. It should also account for the longer labels. |
|
Size Change: +143 B (0%) Total Size: 864 kB
ℹ️ View Unchanged
|
|
Haiii @gziolo ! After playing around with it for a while, I think the better UI may be to provide shorter labels underneath the buttons (rather than the long labels): To ensure screen readers have context, I've added the long labels as I think making the label clickable would be ideal. However, I think it may be quite involved to restyle the wrapper button, and simulate a fake button within (to allow for both Button + Label to be clickable). Alternatively! I think perhaps these may be better if they were (Totally can be done later) Anywhoo! Let me know if my pushed fixes are okay! |
|
Looks good! It'll need a rebase with G2, but worked well regardless. Thanks for jumping into this @ItsJonQ. |
a1b6b69 to
40feb92
Compare
e1d8bd8 to
5ece310
Compare
|
@ItsJonQ thank you for all your help. I like the approach you took 👍 |
5ece310 to
66bc158
Compare
| onClick={ () => onSelect( variation ) } | ||
| className="block-editor-block-variation-picker__variation" | ||
| label={ variation.title } | ||
| label={ variation.description || variation.title } |
There was a problem hiding this comment.
description is optional, so we should fallback to title when not provided.
See:
gutenberg/packages/blocks/src/api/registration.js
Lines 67 to 87 in 7906556
youknowriad
left a comment
There was a problem hiding this comment.
I didn't test but code-wise, this looks good to me. I'll leave the final call for designers.
|
Let's process with this PR as is, we can always iterate later. |



Fixes #18737.
Description
I'm testing reusing the existing label of the pattern as the actual label rendered. In that case, we probably would have to improve copies for the columns block.
How has this been tested?
Screenshots
It needs more love on the CSS side of things:
Types of changes
Checklist: