Image title and alt tags not displaying

I’m in academia and there’s a huge push about accessibility since Harvard and MIT got ADA suits because MOOCs weren’t screen-reader compliant. I’m trying to be a good citizen and include alt tags, but it seems that they are not showing up. They’re in the HTML, though, so I guess screen readers will see them. It makes it hard for me to check, though. I guess this is a simple CSS fix?

I can’t see alt or title tags on this image:

this is an alt tag

On a related note, it would be nice if the <img ...> tags that get created on an upload included something like alt="image description" so that people who don’t know to add that get a little bit of help.

Er… what? Look at the browser DOM.

<img src="https://d11a6trkgmumsb.cloudfront.net/original/3X/4/f/4faf3120c821aa8e239fe74c8568ca4afaca6433.png" 
width="206" height="44" 
alt="this is an alt tag" 
title="This is the picture title">

In Markdown you do it this way

![Image text goes here](http://commonmark.org/help/images/favicon.png)

Feel free to send links to our Markdown help page, and the 10 minute interactive tutorial is on a big giant button there.

Well, I see it now. It didn’t make sense that this could be a problem, but I swear that those weren’t showing up when I posted this.

Well, there is a slight difference between a reply inserted dynamically in the page in your browser when the reply is composed, and what is rendered to everyone else who reads it (or if you re-enter the topic, or refresh the page etc).

1 Like

The Markdown fragment

![SPPM with RT Direct Lighting](upload://x1828bKPKA0BZDckEtlgeNFwad0.jpeg)

does correctly produce an <img> tag with an alt attribute, however it would be nice if that image title or description would be shown when hovering over the image or clicking on it. Currently it’s not shown anywhere:

(In fact the title I’ve set on this image is not shown anywhere.)

This is with Discourse v2.2.0.beta1 +22.

4 Likes

I liked this reply and tried to find the github issue form, so, um, small bump.

What is being advocated here for is to duplicate the alt= and title= elements on the <img> tag but I remember reading that this is not recommended a bunch of places. For example

http://www.w3.org/TR/html/dom.html#attr-title

Relying on the title attribute is currently discouraged as many user agents do not expose the attribute in an accessible manner as required by this specification (e.g. requiring a pointing device such as a mouse to cause a tooltip to appear, which excludes keyboard-only users and touch-only users, such as anyone with a modern phone or tablet).

alt is the important attribute, title is kinda… honestly irrelevant in today’s mostly-smartphone world?

I think the issue is more about which info lightbox uses to caption an image (the caption bar which appears on mouseover/touchscreen-press, and always visible in the gallery viewer).

The lightbox caption bar currently appears to use info from a title attribute in a.class=lightbox, where that title attribute holds the image’s filename, plus image resolution & filesize (the image filename appears again in the mouseover tooltip, where it seems lightbox is generating this tooltip using CSS, as the img tag has no title attribute).

Preferred would be for lightbox to use the img alt data from markdown in the caption bar, i.e. from [alt text]($img_url), with perhaps the complete filename/resolution/filesize in the mouseover tooltip (info which is potentiallly useful for a desktop user, not so much for a touch-device user).

2 Likes

Err, I see now looking more closely at the RAW, the HTML source, the ‘related note’, and follow-ups, how this ambiguously titled topic ended up conflating a feature change request with a non-issue. oops!

I opened a proper feature request for the idea of improving the lightbox overlay: Display an Image's alt or title attribute in ligthbox overlay