DEV Community

Robert Pearce
Robert Pearce

Posted on

1

Figure & Figcaption: Supporting IE11, JAWS, NVDA, & VO

Originally posted on https://dear-dia11y.com/figure-and-figcaption-supporting-ie11-jaws-nvda-and-vo.html

Dear dia11y,

At work, I must support IE11 along with all the other major browsers, so that means I need to support JAWS & NVDA across these browsers on Windows in addition to VoiceOver on macOS & iOS Safari (I don't do much in the Android world at the moment).

About 1-2 months ago, I did a lot of work fixing up issues around <figure>s and <figcaption>s. For a refresher, here's the example that MDN uses:

<figure>
  <img
    alt="Elephant at sunset"
    src="/media/cc0-images/elephant-660-480.jpg"
  />
  <figcaption>
    An elephant at sunset
  </figcaption>
</figure>
Enter fullscreen mode Exit fullscreen mode

This is straightforward, but JAWS + IE11 didn't quite recognize this as a figure, and we had issues with the caption because we had a <div> as the parent of the <figcaption>. NVDA + Firefox didn't like this setup, either. Here's what our example was structured like:

<figure>
  <img
    alt="Elephant at sunset"
    src="/media/cc0-images/elephant-660-480.jpg"
  />
  <div>
    <figcaption>
      An elephant at sunset
    </figcaption>
  </div>
</figure>
Enter fullscreen mode Exit fullscreen mode

After going back and forth with different combinations of elements and attributes, here's what was settled on to make this work across all these browsers and screen readers:

<figure aria-labelledby="caption-id" role="figure">
  <img
    alt="Elephant at sunset"
    src="/media/cc0-images/elephant-660-480.jpg"
  />
  <figcaption id="caption-id">
    An elephant at sunset
  </figcaption>
</figure>
Enter fullscreen mode Exit fullscreen mode

Adding role="figure" to the <figure>, explicitly stating that it was labelled by the <figcaption>, and placing <figcaption> as an immediate child of <figure> resolved all our issues.

This was a helpful table of related compatibility: https://www.powermapper.com/tests/screen-readers/labelling/img-figcaption/

Yours,
Robert W. Pearce

Sentry blog image

How to reduce TTFB

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

In this article, we’ll see how we can identify what makes our TTFB high so we can fix it.

Read more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay