Problem/Motivation

The help text for the "Alternative Text" input in Image Field Widgets suggests that it can be used for SEO (emphasis mine):

This text will be used by screen readers, search engines, or when the image cannot be loaded

While it's certainly true that search engines like Google appear to make use of image text alternatives, they are not the intended audience. It's quite common to find images where an author has used the ALT attribute for SEO keyword stuffing, and it's very unhelpful for any of the intended scenarios. I don't want to encourage that in Drupal's UI.

The W3C HTML 5.1 recommendation does not list SEO as a benefit of ALT. See 4.7.5.1. Requirements for providing text to act as an alternative for image.

In fact neither the HTML 5 / 5.1 recommendations nor the Understanding WCAG 2.0 working group note make any mention of search engines in relation to Alternative text for images.

Proposed resolution

Remove the suggestion that this should be used for SEO.
Suggestion from comment #4 is:

Replacement text for use when images are not available. Important for screen readers.

Update the description for "text alternative" in ImageWidget.
The ImageWidget settings form also needs updating.

Remaining tasks

Write a patch.

User interface changes

Minor change to the description of the "text alternative" field in ImageWidget.

API changes

None.

Data model changes

None.

Comments

andrewmacpherson created an issue. See original summary.

andrewmacpherson’s picture

Joomla uses this help for Alternaitve Text (screenshot attached):

Alternative text used for visitors without access to images.

(Thanks to Brian Teeman from the Joomla project for providing a screenshot of this.)

andrewmacpherson’s picture

Title: ImageWidget Aternative text description should not encourage SEO abuse » ImageWidget Alternative text description should not encourage SEO abuse

FWIW, I don;t much like the way the Joomla description for text alternatives uses the word "access". It's overloaded, and may be confused with field permissions or such.

The HTML 5.1 recommendation describes the alt attribute this way:

Replacement text for use when images are not available

andrewmacpherson’s picture

How about:

Replacement text for use when images are not available. Important for screen readers.

andrewmacpherson’s picture

Issue summary: View changes
andrewmacpherson’s picture

Title: ImageWidget Alternative text description should not encourage SEO abuse » Image Field Alternative text description should not encourage SEO abuse
Status: Active » Needs review
StatusFileSize
new2.32 KB

This patch changes the Image Widget and the field settings form.

Updating issue title, it's not just about the field widget plugin.

manuel garcia’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @andrewmacpherson for this.

The text makes sense, the patch is simple enough - good to go in my opinion.

andrewmacpherson’s picture

Status: Reviewed & tested by the community » Needs review

@manuel Thanks for RTBC, but I'm still not completely sure about the best way to phrase this. I'm going to ask for some feedback from the Drupal a11y slack channel. Ideally we'll find a succinct way to convey the usefulness of text alternatives.

I looked for the history of the alt-text description in core, to see if there was any discussion behind including the search engine phrase. It turns out this description has been in use since the image field widget was added to core, in #560780: Add Image Field to image.module.

The search engine advice came about in contrib, in the days of imagefield-5.x-2.x, in #366078: improve ALT text field description. The mention of search engines was a deliberate ploy to get people to provide ALT text at all, though without much discussion.

Most people won't care about screen readers, but everyone will fill out their ALT text if it gets them some SEO. :)

There's a non-FieldAPI alt text input being introduced at #2780293: Add GUI to configure the site's logo alt attribute too.

mgifford’s picture

Maybe, rather than listing the reasons that someone should add alt text, we simply state it as a best practice.

"Adding meaningful alternative text to your images is the best way to ensure that everyone can benefit from your content."

I think I had a better wording for that a while ago, but is there any reason not to just keep it general and as a best practice?

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

andrewmacpherson’s picture

Issue tags: +Novice, +Nwdug_may18

@mgifford

Maybe, rather than listing the reasons that someone should add alt text, we simply state it as a best practice.

I like that idea. Let's try ideas long this line.

kolin’s picture

Picked this up at Drupal Camp Scotland.

kolin’s picture

StatusFileSize
new2.63 KB
new1.91 KB
kolin’s picture

Issue tags: +DCScot18
kolin’s picture

StatusFileSize
new2.61 KB
new2.44 KB

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

seangambierross’s picture

I've picked this up at #uoecontributiondayAug2018

seangambierross’s picture

I've applied this patch and reviewed it. Replacement text has been applied and updated. Everything looks good and is working as it should.
I've also attached some screenshots for reference.

andrewmacpherson’s picture

Status: Needs review » Closed (duplicate)
Related issues: +#2991149: Improve placeholder text for image upload

Thanks for working on this, @kolin and @seangambieross. Patch #17 correctly maker the text changes suggested here.

However we have a duplicate issue which has had more discussion, and is RTBC now. I'm closing this one. and transferring your credit over there. I couldn't find this issue for a while.