arve0/markdown-it-implicit-figures

figcaption option should remove alt from the image

Closed this issue ยท 6 comments

Duplicating same text both in the img and figcaption is pointless, and will only cause users to see or hear same text twice, which doesn't improve accessibility but rather worsens experience.

Hence I'd argue that when figcaption is enabled and text is rendered in a separate element, it should be removed from the img itself.

arve0 commented

Thanks for submitting ๐Ÿ‘

will only cause users to see

That is true when src is broken.

or hear same text twice

What kind of screen reader do you use?

TBH, I personally don't (although not hard to try), but it's something I've heard frequently about from blind users. E.g.: https://stackoverflow.com/a/58468470/439965

Copying the text of the figcaption into the alt attribute, or any shortened version, is almost always useless: the screen reader will read twice the same or almost the same information, and it's worth absolutely nothing

arve0 commented

released in v0.10.0

Could you please add an option remove_alt_if_use_figcaption=true? This allows users who previously depended on alt to maintain the same logic. For instance, I use alt attribute in css to change the size of speicific image in my blog. Thanks~

img[alt="specific_image"] {
  max-width: 384px;
}
arve0 commented

Hi @SF-Zhou ๐Ÿ‘‹ For now you can pin the version to 0.9.x. Also, you might be interested in using attributes: https://github.com/arve0/markdown-it-attrs

It seems like there are two different kind of camps
https://www.scottohara.me/blog/2019/01/21/how-do-you-figure.html#a-figcaption-is-not-a-substitute-for-alt-text
Which is why I am also in favour of a remove_alt_if_use_figcaption option.