This is a patch to fix some accessibility issues and improve compliance with Swedish government accessibility guidelines.

  1. alt attribute now defaults to nothing instead of the file name. File names are not meaningful to visually impaired users and alt text should not be generated automatically. Screen readers skip images with empty alt attributes.
  2. alt text is limited to 80 characters (in the form only). Longer descriptions should use longdesc, not alt.
  3. Added option that adds the attribute longdesc. This is an URL that links to a page describing the image. Seldom used but often required.
  4. Added an option to make alt text or longdesc mandatory unless the user checks a box classifying the image as "decorative".
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dopry’s picture

Status: Needs review » Needs work

I'd love a link to those accessibility guidelines.

1) ALT is a required but I'm not sure that means in cannot be empty.
2) I would like to keep it at 255.. since that is what I'm already storing in the DB.
3) should we make long desc a URL? Or should it be text input that we create a custom callback for so it can be ajaxed into docs or used as caption text? or should it be optional.
4) I don't really like the decorative option. I would prefer a required option per field.

would you be willing to roll the patch against HEAD as well?

dopry’s picture

Version: 5.x-2.x-dev » 6.x-3.x-dev
Boletus’s picture

henrrrik’s picture

The CMS evaluation document that I was referring to above isn't available in English, but the main Swedish National Guidelines for Public Sector Websites document is.

http://www.verva.se/english/public-sector-development/listening-to-citiz...

However, I'd like to stress that this not some quirky Swedish thing. The Swedish VERVA guidelines are more the less the same as the ones in WCAG 1.0 and U.S. Section 508 (and the best practice recommendations that flesh them out).

  1. Isn't the point of a required field that it can't be empty? The problem with autogenerating alt field text is that
    • A lot of users won't bother to change the default.
    • Any default text will most certainly not be helpful to anyone anyway.

    The current implementation means that screen reader users will very likely have to listen to stuff like "Image: DSC_512341.jpg" if they access a page with imagefield content.

  2. This is obviously not a biggie since 80+ character alt texts are extremely rare. However, accessibility validation tools like Cynthia Says will complain if an alt text is longer than 80 characters and I think it would be nice to prevent overzealous users from making that mistake, however unlikely it might be.
  3. A long desc should be an URL to a page of text describing the image in great detail. I have yet to come across a site that actually uses it, but it would be nice to be able to tick that box on the feature list.
  4. This is essentially a feature to promote good behavior. Since visually impaired users don't need (or want) alt text for decorative images (e.g. "Businessman with briefcase standing on a mountain top") it's good if the alt field isn't required. However, making the field optional means that a lot of users will just ignore it. By making the user check a box to proceed without a description skipping it is an active decision. The XStandard WYSIWYG editor uses this approach.

I've added an issue for this for FileField Image as well: #276699: Accessibility improvements

Rolled new patches for ImageField 5-x-2.1.

henrrrik’s picture

I've created a patch that adds support for default alt and title text with tokens that ties into this: #277637: Default alt and title text with token support

henrrrik’s picture

Just an update to point out that the alt and title attributes are empty by default in version 6.x-3.0-alpha1, so this issue has been partially adressed.

quicksketch’s picture

Hi henrrrik, I'm now supporting ImageField, so I'm trying to wrap my head around these improvements.

Generally speaking, I think these changes would put a lot of unnecessary burden on site administrators. Even though I've built hundreds of web sites, if I saw an option for "Force decorative" I'd be left scratching my head unless I read the source code. Terminology like "required" is much more common and understood in the Drupal community.

I'm not sure we should include a configuration option for "longdesc" at all. Like you say, you've never once seen a site using it. If we did support it, it would make sense to auto-generate the extended help page from text entered in a textarea, rather than having users enter a URL (since how would they put anything at that URL in Drupal?). However, considering ImageField is used by tens of thousands of websites, do we want to burden the every-day administrator with an option that they'll never use?

If we do include some of these options, I think I'd like to see them all grouped together in a separate fieldset in the widget configuration. This way administrators will know why we're asking them for rather obscure configuration options.

Some configuration options that might be under this fieldset:

- Accessibility options -

[ ] Limit ALT text to 80 characters
[ ] Require ALT text unless "Decorative" option is checked
[ ] Enable longdesc field for long descriptions

Note with each one of these options we'd probably want to link to accessibility guidelines that state why you'd want to do each one of these. Like I said, I'm not keen on the term "Decorative", but if this is a standard accessibility term then that would be acceptable. Placing it within "Accessibility options" would at least give it some context.

henrrrik’s picture

I agree that they should be optional (though restricting ALT to 80 characters might not be such a big burden) and grouping them under "Accessibility" is a good idea (might even promote some awareness).

I don't know how much effort longdesc is worth, I'll post something in gdo/accessbility and ask people to weigh in on all this.

quicksketch’s picture

Also, there's a separate request for making the ALT field required here #347070: Ability to make alt and title text required for each image. It'd be good if we could somehow accommodate the field being required without showing the "Decorative" checkbox.

mgifford’s picture

Issue tags: +Accessibility

Great to see this thread here. At gdo/accessibility we've gone into this a bit here http://groups.drupal.org/node/18563#comment-64836

The site administrator needs to be able to configure the level of accessibility that they want to try to enforce within their user community. I would hope that the default options for the module raise the bar for accessibility and that there are reminders about adding alt tags by default. However, ultimately it's the users choice. By convention if the alt tags are empty, it's a decorative image and many designers know this. Think most screen readers just skip images without alt text, but having a reminder for content administrators that without alt text, visually impaired users (such as google) will not be getting value from your image.

Great initiative though. Nice to see the Swedish government's accessibility guidelines kick in. Does this mean that the Swedish government is using Drupal now?

quicksketch’s picture

Note, I also just ran across this issue #366078: improve ALT text field description. I added some descriptions to the ALT and Title fields (we actually didn't have any before).

Alt text description: "This text will be used by screen readers, search engines, or when the image cannot be loaded."
Title text description: "The title is used as a tool tip when the user hovers the mouse over the image."

mgifford’s picture

Might also be useful to check that the title & alt descriptions aren't identical as this isn't helpful. I believe that screen readers don't generally read the title text.

Some good links on the subject:
http://webaim.org/forums/viewtopic.php?id=337
http://www.webaim.org/techniques/alttext/
http://fadtastic.net/2007/04/19/proper-use-of-alt-and-title-attributes/
http://www.accessibilitytips.com/2008/04/14/avoiding-redundant-title-att...
http://www.elated.com/articles/using-alt-and-title-attributes-correctly/

There is a way here that pointing people to good examples of how to describe their content could be good.

Mike

Brigadier’s picture

The term "Decorative" is very well established as meaning an image that doesn't contribute to the meaning of the page. Using it here would be clear and users who aren't familiar will be able to google & get an idea what it means. Having a checkbox for decorative that allows a blank alt text makes sense to me.

I haven't tried the patch but the configuration described by quickscketch at #7 above seems good to me. I'd also be okay with defaulting all those checkboxes to checked, since unchecking them is then a conscious decision to be okay with ignoring WCAG.

mgifford’s picture

I just wanted to bring up that the great suggestions that @quicksketch made in #7 haven't made it into D7 core. I'm pretty sure they won't at this point so we'll have to look at adding these with a contrib module if they are going to be there.

Everett Zufelt’s picture

Some configuration options that might be under this fieldset:

- Accessibility options -

[ ] Limit ALT text to 80 characters

* I don't see a good reason to limit alt text to 80 characters. Content creators should have the ability to provide a textual replacement of the image (textual "alt"ernative). This may be over 80 chars. I would haveto be pointed to a WCAG 2.0 success criteria which requires this in order to be on board with this option.

[ ] Require ALT text unless "Decorative" option is checked

* This gets into some dangerous ground. What is "decorative"? I work in the accessibility field and I can say that although there are rules of thumb, there is no right answer. Is an image of a sunset in the middle of a blog post about my trip to Cuba decorative? How about a stock photo of a Christmas tree on an a product page for wrapping paper? If we put this "decorative" power into the hands of content creators we need to ensure that they truly understand what is and is not decorative, at least that they adopt a consistent approach for their own content, if not across the site.

[ ] Enable longdesc field for long descriptions

* @longdesc has been obsoleted in html5, although it may come back. Again developers need to know what it is, why and when to use it. They also need to understand the lacking support by some UAs, including some screen-readers.

quicksketch’s picture

I don't see a good reason to limit alt text to 80 characters.

We've actually already limited alt text to 80 characters for over a year now in ImageField, so this is actually necessary at all anyway. It's per this recommendation: http://www.gawds.org/show.php?contentid=28

In order to increase this length you can override it in your settings.php file or with devel module by setting the "imagefield_alt_length" hidden variable.

I still don't like the idea of a "decorative" checkbox either. Since you'll probably get 1 out of a 1000 editors that knows what to do with it and uses it properly. As a web developer for years and years I probably won't know what to do with it even though I've read the spec multiple times.

On longdesc, I'm not sure it's really worth implementing at all.

quicksketch’s picture

Huh, well after actually looking at that page I found that 80 characters doesn't seem to be mentioned there any more. Weird, I know we got that from somewhere or I wouldn't have set it to 80 to begin with.

quicksketch’s picture

Status: Needs work » Closed (won't fix)

We're not implementing any significant features in D6 any more. Any similar requests should be refiled against Drupal core now that Image field is in core.

mgifford’s picture

I added a follow-up issue here #1971222: Incorporate longdesc into image support as longdesc isn't in D7 yet.

Thanks for following up on this @quicksketch!