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

Image block: Add font size control for captions #34643

Closed
Tracked by #38533
scruffian opened this issue Sep 8, 2021 · 5 comments
Closed
Tracked by #38533

Image block: Add font size control for captions #34643

scruffian opened this issue Sep 8, 2021 · 5 comments
Labels
[Block] Gallery Affects the Gallery Block - used to display groups of images [Block] Image Affects the Image Block [Feature] Blocks Overall functionality of blocks

Comments

@scruffian
Copy link
Contributor

What problem does this address?

Themes need a way to control font size of captions for image blocks.

What is your proposed solution?

We could add a control for font size to the block and have it target captions with experimentalSelector. Alternatively we could add support for figcaption to the elements part of Global Styles.

@scruffian scruffian added [Feature] Blocks Overall functionality of blocks [Block] Gallery Affects the Gallery Block - used to display groups of images labels Sep 8, 2021
@mtias mtias mentioned this issue Sep 8, 2021
65 tasks
@glendaviesnz glendaviesnz added the [Block] Image Affects the Image Block label Sep 9, 2021
@glendaviesnz glendaviesnz changed the title Gallery block: Add font size control for captions Image block: Add font size control for captions Sep 9, 2021
@glendaviesnz
Copy link
Contributor

glendaviesnz commented Sep 9, 2021

Changed the title to Image block as once experimental flag removed for refactored gallery the gallery images are Images blocks - so fix should primarily target the Image block. Switch it back @scruffian if I have misunderstood this.

@ramonjd
Copy link
Member

ramonjd commented Jan 6, 2022

Just adding some cursory experimental findings.

I added typography block support to the Image block and gave the <figcaption /> a style of font-style: inherit, overriding the currently-defined 13px.

Works fine, albeit the default figcaption font size inherits from up the tree somewhere, in the example below, from --wp--preset--font-size--normal so it's slightly bigger.

Screen Shot 2022-01-06 at 3 12 49 pm

The 13px, I discovered, comes from a mixin that adds default styles to captions for Audio, Embed, Table and Video Blocks, under the assumption that "figcaptions are not likely to be styled in the majority of existing themes". Example

So to keep the status quo we'd need to ensure that the 13px from the mixin is the default until a user-defined font value is detected.

I'm not so sure that typography support on the Image block is even appropriate. Perhaps we could had something to the block inspector toolbar?

Screen Shot 2022-01-06 at 3 29 00 pm

@beafialho
Copy link

+1 this would be really useful! In addition, it would be great to be able to edit the alignment of the caption to be center, left and right aligned.

@richtabor
Copy link
Member

Alternatively we could add support for figcaption to the elements part of Global Styles.

@scruffian Think this is good to close, now that we have captions in Global Styles via #34643?

@scruffian
Copy link
Contributor Author

Happy to close this for now. If we feel like we need per-block control we can open another issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Gallery Affects the Gallery Block - used to display groups of images [Block] Image Affects the Image Block [Feature] Blocks Overall functionality of blocks
Projects
Status: Done
Development

No branches or pull requests

5 participants