theme_feed_icon currently sets the alt attribute for the feed icon image to "Syndicate content" and allows for an alternate string to be passed for the title attribute for the image.

1. It is not best accessibility practice to have different strings for the alt and title attributes of an image, see #520704: How should theme_image() deal with screen readers not reading the image title attribute?

2. The alt text is not very meaningful to most screen-reader users. What does "syndicate content" mean?

For 2 I recommend changing the alt text to something more meaningful. Possibly:

1. Syndicate RSS feed of page content

2. RSS Feed

3. Syndicate content: RSS Feed

Any other suggestions?

theme_feed_icon http://api.drupal.org/api/function/theme_feed_icon/7

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Everett Zufelt’s picture

Issue tags: +Accessibility

tagging

annmcmeekin’s picture

How about dropping the jargon of Syndicate (because nobody really uses feeds to syndicate content these days, and hardly anyone in the real world understands what that means in relation to RSS feeds) and rewrite the alt text to something along the lines of:

"Subscribe to [page/site] RSS feed"

or even just "Subscribe to [context]"

Everett Zufelt’s picture

Status: Active » Needs review
FileSize
854 bytes

Rolled a patch re: Ann's suggestion above.

This patch

1. Replaces the $title param with $description in the function definition.

2. Removes the title attribute from the feed icon img element.

3. Replace the alt attribute of the feed icon img element, which was "Syndicate content", with "Subscribe to " + $description.

webchick’s picture

I like the text changes very much!

+++ includes/theme.inc	14 Aug 2009 11:05:34 -0000
@@ -1683,11 +1683,11 @@ function theme_more_help_link($url) {
-function theme_feed_icon($url, $title) {
-  if ($image = theme('image', 'misc/feed.png', t('Syndicate content'), $title)) {
+function theme_feed_icon($url, $description) {
+  if ($image = theme('image', 'misc/feed.png', t('Subscribe to ') . $description)) {

Hm. Either we need both $title and $description into this function, or we need to repeat the description as the 4th function argument. The old code passed the $title along as the title attribute of the image. The new code removes the title attribute of the image. Or is that by design?

Also, t('Subscribe to ') . $description) is not translatable. Need to use placeholders like t('Subscribe to @description')

17 days to code freeze. Better review yourself.

webchick’s picture

Status: Needs review » Needs work
Brigadier’s picture

Status: Needs work » Needs review
Issue tags: +RSS, +syndication

Not to be picky but could you do

t('Subscribe to ') . $description . t(' RSS feed')

There are modules that do subscription via email and I think there can be confusion.

And I'm not a translation expert so I don't know if the form you used is preferred or if

t('Subscribe to %desc RSS feed', array('%desc' => $description))

is easier to translate (though my instinct says the first form is probably better).

Everett Zufelt’s picture

@webchick

Removing the title attribute is by design, as title is often used to convey information that is not accessible to screen-reader and keyboard only users. We can add it back in using the exact same text as the alt attribute to preserve the tooltip

As far as translation goes, it is not possible to translate a variable, only a literal string.

t() is designed for handling code-based strings, in almost all cases, the actual string and not a variable must be passed through t(). Extraction of translations
is done based on the strings contained in t() calls. If a variable is passed through t(), the content of the variable cannot be extracted from the file
for translation. (
http://api.drupal.org/api/function/t/7)

The calling method would have to translate $description before calling theme_feed_icon(), at which point we are left with:

1. Leave T('Subscribe to ') . $description

2. Get rid of the 'Subscribe to' string altogether, and provide docs to explain how to write meaningful $description's for the RSS icon.

catch’s picture

Status: Needs review » Needs work

@Everett - you can't translate variables, but you need the variable substitution in t() strings to give context -

So this is correct - the translator can tackle everything including the placement of %desc if subject/object/verb order is different in their language since they have access to the entire string in one place.

t('Subscribe to %desc RSS feed', array('%desc' => $description))

<?php

Everett Zufelt’s picture

Status: Needs work » Needs review

Rerolled this patch.

1. T() now contains a placeholder for $description to provide context for translaters.

2. Leaving RSS Feed off the end of the alt attribute string, to allow developers more freedom to name these icons the way they prefer.

3. I notice that on the default d7 frontpage that the string being passed as $description is wrapped in em elements, not sure where this is being generated, but it seems like a small tweak for after code freeze.

Everett Zufelt’s picture

FileSize
900 bytes

Patch

mgifford’s picture

+1

annmcmeekin’s picture

+1 from me too.

Brigadier’s picture

Patch looks good to me.

mgifford’s picture

Status: Needs review » Reviewed & tested by the community

this is great!

Dries’s picture

Well, the patch is a bit confusing because we always pass in the _title_ when we call theme('feed_icon'). Calling it 'description' is confusion because RSS feeds have also a description. So, we're effectively mixing up titles and descriptions. I'd suggest we reroll renaming the variable back to $title.

Dries’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Novice

Let's do a quick re-roll.

Everett Zufelt’s picture

Status: Needs work » Needs review
FileSize
743 bytes

@Dries

Changed variable to $title as recommended in comment #15

Dries’s picture

Status: Needs review » Fixed

Looks nice and simple now. Committed to CVS HEAD. Thanks!

webernet’s picture

Category: task » bug
Status: Fixed » Needs work

The reason the title attribute was added in the first place was to give the image a tooltip description. The alt doesn't do that. There isn't any way to tell what the image links to without inspecting the HTML anymore. This is a regression.

webernet’s picture

Status: Needs work » Needs review
FileSize
809 bytes

Restores the title attribute.

Dries’s picture

From an accessibility point of view, if we add the alt-tag, can we remove the title-tag?

webernet’s picture

FileSize
913 bytes

Alt is required for the image, how about the title on the link? Also fixed % to @.

Everett Zufelt’s picture

@Dries

Title is not required for accessibility. The title attribute was never intended to be used for important information / tooltip. If the argument is that people won't know what this icon does without using the title attribute then a new approach needs to be found, as the title attribute isn't intended to be used for that purpose.

@webernet

I like the patch in #22, adding alt to the image and title to the link seems like the best approach.

Wondering if $title needs to be check_plain'd / checked to see if it is not empty. If empty then we could use a default string of text.

mgifford’s picture

Status: Needs review » Reviewed & tested by the community

This patch works as promised and should be committed!

The spam above this comment #24 should be deleted and sballer banned from the site.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks!

Everett Zufelt’s picture

Status: Fixed » Needs work

Setting to needs work to add documentation.

Cliff’s picture

@Everett, let me know if I can help.

Everett Zufelt’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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

Liam Morland’s picture

tagging