Skip to content

Avoid using <figcaption> for image alternative text #99

@yamanoku

Description

@yamanoku

Problem

Currently, in Post.tsx lines 219-223, <figcaption> is being used as the alternative text for images.

medium.description && medium.description.trim() !== "" ? (
<figure>
<Medium medium={medium} />
<figcaption>{medium.description}</figcaption>
</figure>

However, <figcaption> should be used as a caption (description) for the image, not as alternative text. Alternative text is used to convey the content of the image to users who cannot visually perceive it. On the other hand, a caption is meant to supplementarily explain the content of the image.

In this state, screen reader users might have both the image's alt text and <figcaption> element read aloud twice, redundantly.

Example Case

Example code screenshot, The Japanese text "機動戦士 Gundam ジークアクス Beginning 入場特典第二弾の原案資料の表紙" is inserted in both the alt attribute of the img element and the figcaption element that wraps it.

Suggestion

Images using only <Medium medium={medium} />, without using <figure> and <figcaption> elements.

{post.media.length > 0 && (
  <div>
    {
      post.media.map((medium) => (
        <Medium medium="{medium}" />
      ))
    }
  </div>
)}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions