Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Restyle figures and captions #4276

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

patrickhlauke
Copy link
Member

@patrickhlauke patrickhlauke commented Mar 13, 2025

  • Change 11ty/liquid script to wrap the auto-generated "Figure X" in a <span>
  • Add CSS overrides
  • Optional: add light border around actual figure images (makes them look a bit tidier?)

Closes #4241

* Change 11ty/liquid script to wrap the auto-generated "Figure X" in a `<span>`
* Add CSS overrides

Closes #4241
Copy link

netlify bot commented Mar 13, 2025

Deploy Preview for wcag2 ready!

Name Link
🔨 Latest commit 584b016
🔍 Latest deploy log https://app.netlify.com/sites/wcag2/deploys/67ddc02b8b53ae0008ebbddd
😎 Deploy Preview https://deploy-preview-4276--wcag2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@patrickhlauke
Copy link
Member Author

patrickhlauke commented Mar 13, 2025

@patrickhlauke patrickhlauke changed the title Restyle figure captions Restyle figures and captions Mar 13, 2025
@iadawn
Copy link
Contributor

iadawn commented Mar 19, 2025

My preference would be for this to be a bit more aligned with the figure caption styling in TR space. Separating the word 'figure' and the figure number from the caption text seems to be peculiar. I am also not overly keen on adding another border - not sure that this sort of attention is necessary.

I was thinking something more like the following example:

alternative presentation for figure captions

@@ -243,7 +243,7 @@ export class CustomLiquid extends Liquid {
$("figcaption").each((i, el) => {
const $el = $(el);
if (!$el.find("p").length) $el.wrapInner("<p></p>");
$el.prepend(`Figure ${i + 1}`);
$el.prepend(`<span>Figure ${i + 1}</span>`);
Copy link
Contributor

@kfranqueiro kfranqueiro Mar 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to try @iadawn's suggestion of inlining the "Figure N", it would go something like this, in order to insert it into the first paragraph within the figcaption: (note this will also require updating the style selector)

Suggested change
$el.prepend(`<span>Figure ${i + 1}</span>`);
$el.find("p").first().prepend(`<span>Figure ${i + 1}</span> &mdash; `);

(To be clear though, RE @iadawn's comment, "Figure N" was already separated like this prior to this PR)

@patrickhlauke
Copy link
Member Author

I was thinking something more like the following example

if we're not going for a border, i'd strongly suggest we at least then increase the margin after the caption further, to more clearly separate it from non-caption text that follows - otherwise, particularly for long (or even multiline) captions, it again becomes difficult to discern where the caption ended and the rest of the prose starts again

@patrickhlauke
Copy link
Member Author

I personally prefer having an extra indicator like a border, I'll admit ... it visually breaks up long pages with lots of images/captions from being just a see of prose with images dotted around. Happy to go for the "Figure..." inline.

Dropping the border and left padding, and inlining the figure, this current PR would then look like this

one of the figures and figure captions, without border of the left

Personally still prefer it with...

same, inlined 'Figured' text, but with border on left

@shawna-slh
Copy link
Contributor

shawna-slh commented Mar 19, 2025

A left border would visually highlight it and draw attention to it. I think you want the opposite, for the figure caption to be quiet.

@patrickhlauke patrickhlauke self-assigned this Mar 21, 2025
@patrickhlauke
Copy link
Member Author

To discuss at today's meeting. Happy to mod/change the PR once we decided.

@mbgower
Copy link
Contributor

mbgower commented Mar 21, 2025

A left border would visually highlight it and draw attention to it. I think you want the opposite, for the figure caption to be quiet.

@shawna-slh the problem we're encoutering, particularly for large figcaptions, is that if the styling is "quiet" people read it as if it is the main content, and get confused. And by "people" I mean almost everyone who has been working on it :)

If you look at the editor's draft version of the Reflow document, it makes its own case for this problem, IMO.

So, counterintuitively, a 'louder' figcaption styling difference makes it is easier to distinguish and skip when one is just reading the main narrative. I think there are many examples of this in the wild (for example, where the main justified, the figcaptions are center-aligned and set in italics at a larger point size).

@kfranqueiro
Copy link
Contributor

kfranqueiro commented Mar 21, 2025

After further discussion and clarification with Shawn:

  • Instead of "Figure N" as separate paragraph, inline "Figure N."
    • Ending with period, not dash; regular weight (not bold)
    • This follows multiple common style guides, e.g. Chicago, MLA
  • May want to reduce or remove top margin of the first p in the figcaption, as inlining "Figure N" in the first paragraph ends up putting more space between the image and the figure's label (whereas before it was not inside a paragraph)
  • Remove leading border
  • Restore bottom border; make darker
  • Ensure there is more space after the bottom border than before it
    • i.e., increase bottom margin of figcaption to e.g. 2em

Examples from Reflow:

Figure 5, where the figure is immediately followed by another paragraph

Figure 6, where the figure is immediately followed by another image/figure

Figure 13, where the figure caption spans 2 paragraphs and is followed by a heading

@patrickhlauke
Copy link
Member Author

Restore bottom border; make darker

not a big fan of that, personally, as - since the border is then the full width of the content column - it creates a very strong visual break of the whole page every time there's an image with a caption ... at least for me, that makes a long page with lots of images strangely "bitty" / stop-and-start

@patrickhlauke
Copy link
Member Author

@shawna-slh
Copy link
Contributor

shawna-slh commented Mar 21, 2025

Thanks Ken and Patrick, it's helpful to see options on a full page (which I think Ken was avoiding so as not to steps on the toes of this PR :). Now I can see @patrickhlauke 's point.

Currently the text size is smaller for the figcaption, which I think is good as one differentiation from the main text.

Perhaps along with that, using spacing and proximity would be enough.

  • Remove the space between the image and the figcaption
  • Leave lots of space after the figcaption

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

Successfully merging this pull request may close these issues.

Revisit figcaption styles
5 participants