Where an image is the only item in a link it requires an ALT attribute. Otherwise, screen readers and other assistive technologies must speak the SRC attribute, which is meaningless (HTML5 specification, 4.8.1.1.2 A link or button containing nothing but the image).

The line in question is, ../oembed/oembedcore.module?..#l408

Line #408 - current:

    $return .= ' ' . l('<img src="' . check_url($embed->url) . '" />', $url, array(...)));

Line #408 - suggested fix (attached):

    	$alttext = empty($embed->title) ? t('Embedded image') : $embed->title;
        if (!empty($embed->provider_name)) {
            $alttext .= t(', on ') . $embed->provider_name;  // Improve for i18n.
        }
        $return .= ' ' . l('<img src="' . check_url($embed->url) . '" alt="'. $alttext .'" />', $url,
                array('html' => TRUE, 'absolute' => TRUE, 'attributes' => array('class' => 'oembed-photo oembed-content')));

Comments

nfreear’s picture

Note, the above attachment, oembedcore-ALT-attribute-accessibility.module.txt, is from version 6.x-0.8 - line numbers are a bit out (the code fragments above are from HEAD).

The bug applies to D6 and Drupal 7.

I look forward to your response. Cheers,

Nick

Everett Zufelt’s picture

I took a look at your suggested change, but am unfamiliar with the module. Can you please provide a brief explanation of title and provider_name?

It does appear that you're on the right track, I just want to make sure that the alt text provided is as good as it can be. Agreed that it likely needs a i18n tidy.

nfreear’s picture

Hi Everett,

Thanks for the quick and encouraging response!

Good question. 'title' and 'provider_name' are from the oEmbed standard (http://oembed.com). Taking the embedding of a Flickr image in a blog as an example, provider_name would be 'Flickr', while title is the image's caption or title on Flickr.

The title may be a carefully hand-crafted, meaningful text, or it may be the file-name from the upload eg. DSC12345.jpg. The latter is not great, but given the automated nature of oEmbed, it's probably the best we can do. Alternative suggestions welcome!

The key point is, we need an ALT text, which gives an indication of the content, and the destination of the link (and provides some attribution).

The solution for jquery-oembed may help - note this adds 'author_name' (eg. Flickr user-name),
code.google.com/p/jquery-oembed/.../jquery.oembed.js?r=.#72 code - issue #3.

Best wishes,

Nick

Everett Zufelt’s picture

Thanks,

What you have then seems pretty much as good as it can be, given that the data is coming from another source. Curious if the title / provider name has already been check_plain().

Perhaps replacing 'on' with 'from' or 'posted on' would give a bit more context for the provider name.

jinky32’s picture

+1
We would really like this accessibility feature on our sites too. Be great to have nfreear's solution in the next version!

mgifford’s picture

A patch would be good I expect to move this issue along.. What needs to happen to fix this accessibility issue in the next stable release?

stuart.crouch’s picture

Status: Active » Needs review
StatusFileSize
new1.19 KB

I've created a patch from nfreear's original post.

Anonymous’s picture

Status: Needs review » Fixed

I've committed a variant of this patch on 6.x-0.x branch. Thanks for the contribution!

http://drupalcode.org/project/oembed.git/commit/4fb46d6

Status: Fixed » Closed (fixed)
Issue tags: -Usability, -html, -Accessibility

Automatically closed -- issue fixed for 2 weeks with no activity.