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

Revisit figcaption styles #4241

Open
kfranqueiro opened this issue Feb 21, 2025 · 5 comments
Open

Revisit figcaption styles #4241

kfranqueiro opened this issue Feb 21, 2025 · 5 comments
Assignees

Comments

@kfranqueiro
Copy link
Contributor

kfranqueiro commented Feb 21, 2025

Figcaptions are currently displayed in bold text, due to styles defined WAI-website-wide in /WAI/assets/css/style.css.

This can perhaps be overwhelming for captions that run particularly long, and also limits options to emphasize content within those captions, as pointed out in #4055 (comment).

On the other hand, the existing bold styles do make it easy to distinguish figcaptions from ordinary paragraphs of text within the body.

Some thoughts that came up in discussion on the backlog TF call on 2025-02-21:

  • Make only the leading "Figure N" part of the caption bold
    • Currently these are added by the build system to Understanding docs as separate paragraphs before the content, but not Techniques
    • One technique (G211) has them written in-line within the content
    • If we want to consistently settle on the former, we should remove the few inline instances and consistently apply this across Techniques and Understanding
  • Consider options to ensure long figcaptions are still distinguishable from subsequent content:
    • Increase contrast of the divider line below the figure
    • Use a leading-side border or margin to group the figure and its caption
    • Add styles to figure + figcaption to make the caption match the width of the image? (This may be possible with CSS inline-grid + figcaption width trickery)
      • We would probably want to set a min-width, since some figures are not very wide (e.g. Figure 4 in Non-text Contrast)

WIP exploring options on my fork

Example before and (proposed) after:

Screenshot of Figure 4 from Understanding Non-text Contrast as it exists today, with fully-bolded figcaption text, full width, and extremely low-contrast bottom border

Example of updated styles, including "Figure N" in a preceding paragraph within the figcaption, non-bolded figcaption content, limiting the caption width, and choosing a slightly darker WAI theme color for the bottom border

@kfranqueiro kfranqueiro self-assigned this Feb 21, 2025
@alastc
Copy link
Contributor

alastc commented Feb 24, 2025

I liked Patrick's suggestion of having a line/block to the left of both the image and the caption. So long as it isn't confused with blockquotes? If there's a page of WAI components somewhere it would be useful to see how it fits in with other styles.

@patrickhlauke
Copy link
Member

I liked Patrick's suggestion of having a line/block to the left of both the image and the caption

I can work on a speculative PR for this

@patrickhlauke patrickhlauke self-assigned this Feb 25, 2025
@kfranqueiro
Copy link
Contributor Author

kfranqueiro commented Feb 25, 2025

I liked Patrick's suggestion of having a line/block to the left of both the image and the caption. So long as it isn't confused with blockquotes? If there's a page of WAI components somewhere it would be useful to see how it fits in with other styles.

WAI's blockquote styles only ever include a leading border in instances where there is also a large quote mark in front of it: https://wai-website-theme.netlify.app/components/blockquotes/

@fstrr
Copy link
Contributor

fstrr commented Feb 26, 2025

Could we see a few different designs on the same page with the contents of the figure element being different sizes? Maybe make a copy of 1.4.11 and come up with some different designs?

@kfranqueiro
Copy link
Contributor Author

Possibly worth noting: the WAI design components site has a page on figures, but its only examples use figure class="shrink-wrap", which interestingly features some of the ideas presented above. However, it does not ensure a reasonable minimum width for very narrow images.

The same example from Understanding 1.4.11 as presented in my original issue description, modified to use the shrink-wrap class. The image and caption are contained within a box with a slightly more noticeable gray border around all 4 sides; however, the box is extremely narrow, causing 11 lines of text for what previously required 1 or 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants