The title attribute merely parrots the node title, i.e. title="<?php print $title ?>
, which apart from being redundant (does not add additional information about the link target or context), its annoying for screen readers configured to read title attributes (gets repeated, thus is again redundant).
This issues proposes to remove the title attribute from Drupal core.
Comment | File | Size | Author |
---|---|---|---|
node-title-attribute_1.patch | 676 bytes | Jeff Burnz | |
Comments
Comment #1
Jeff Burnz CreditAttribution: Jeff Burnz commentedI'm not sure why the test has not run, changing to needs review to see for myself if this triggers automated testing:)
Comment #2
geerlingguy CreditAttribution: geerlingguy commentedPlease be sure to make note of this in the related issue: #382870: Update and Polish Node Template Output.
Comment #3
Jeff Burnz CreditAttribution: Jeff Burnz commentedThank-you geerlingguy, that issue had temporarily slipped my mind.
Comment #4
geerlingguy CreditAttribution: geerlingguy commentedWell, since it's been more than a few days without a reply, that issue slipped into page three on my tracker!
Comment #5
mgiffordOk, I don't know who this redundant information would help. As far as I am aware this simplification would be fine.
Comment #6
Jeff Burnz CreditAttribution: Jeff Burnz commentedThanks for tagging this, I seem to always forget to do that.
The patch takes what you have there (which is default) and removes the title attribute, i.e:
Comment #7
cburschkaLooks good, and fixes a real redundancy. The title attribute on a link should indicate where the link goes if that isn't clear from the anchor text - not repeat the anchor text. Seems to be RTBC too.
Comment #8
mgiffordThanks for this. I did understand it, but didn't explain it all that well.
Comment #9
geerlingguy CreditAttribution: geerlingguy commentedSounds good - I agree with the RTBC. Let's commit it. Otherwise, we'll roll it into #382870: Update and Polish Node Template Output.
Comment #10
webchickDoes someone have an "official" external resource regarding title best practices they could point to that explains why Drupal is doing this wrong? I don't disagree, it just would be nice to be able to point at that and go "Ah."
Comment #11
boombatower CreditAttribution: boombatower commentedInterestingly W3C has an example very similar to what we are talking about: http://www.w3.org/TR/REC-html40/struct/global.html#h-7.4.3 , but otherwise doesn't say anything directly.
Other resources seem to directly agree with removing it.
http://fadtastic.net/2007/04/19/proper-use-of-alt-and-title-attributes
http://www.456bereastreet.com/archive/200412/the_alt_and_title_attributes/
I would agree that removing the title attribute that contains a pure duplicate makes sense, both logically and based on online agreement.
Comment #12
Jeff Burnz CreditAttribution: Jeff Burnz commentedFrom RNIB, a site supporting blind and partially sighted people.
The above page is a good resource in general and explores the various issues regarding title attributes and accessibility.
Comment #13
webchickMakes sense to me. Thanks, folks!
Committed to HEAD. Marking "needs work" until this is mentioned on the converting 6.x to 7.x themes page.
Comment #14
cburschka1.) What do we need to tell theme designers - to copy this change to their own node.tpl.php files?
2.) Who can edit that page? I can only see the Revisions tab; is it locked or do I need to apply for a "doc team" role?
Comment #15
xmacinfoActually this modification does not need documentation. Adding or removing the title attribute in themes do not have any compatibility impact with Drupal 6 or Drupal 7.
However, we need to update the Garland theme; so it's best to keep this at "needs work" until Garland is modified as well.
Comment #16
LeeHunter CreditAttribution: LeeHunter commentedThe Theming Guide seems a little weak in the area of accessibility. Well, actually, there doesn't seem to be anything at all. I've added an issue to the doc queue (http://drupal.org/node/462532) suggesting there should be at least one accessibility page in the best practices section (http://drupal.org/node/341707).
Comment #17
mgiffordwebchick - I can't edit this page - http://drupal.org/node/254940
But also not sure that it needs to be there, particularly since there's been work done on the Theming Best Practices page - http://drupal.org/node/464472
LeeHunter - thanks for pointing us to the hole in the theming documentation for accessibility. It is coming along now thanks to a great start by jmburnz.
Mike
Comment #18
Everett Zufelt CreditAttribution: Everett Zufelt commentedGreat patch, this is something that I noticed when I first started using druPpal, Aas some developers use the title attribute for tooltip text and some assistive technology reads this and not the linked text.
I see that this is now in head. I don't think that this really needs to be documented on http://drupal.org/node/254940 . It would be nice if Garland followed the same practice and if this was explained on the accessibility best practices page.
Is there currently an open issue to make this change to Garland?
Comment #19
Everett Zufelt CreditAttribution: Everett Zufelt commentedI have created an issue to remove the title attribute from node title for Garland http://drupal.org/node/518284
I also copied the concept from the patch for this issue and uploaded a patch for review for the Garland specific issue.
Comment #20
Everett Zufelt CreditAttribution: Everett Zufelt commentedThe Garland specific patch has been commited to head and the issue marked as Fixed http://drupal.org/node/518284 .
What else needs to be completed to have this issue marked as Fixed?
Comment #21
Jeff Burnz CreditAttribution: Jeff Burnz commentedThis was rolled into #382870: Update and Polish Node Template Output so best to help out there.
Comment #22
xmacinfoIn #13 webchick is asking for documentation. This is why it's not fixed.
However I feel that this does not require any documentation.
Comment #23
geerlingguy CreditAttribution: geerlingguy commentedI second the unneeded documentation... if anything, we could say "The title attribute was removed from node titles because it's redundant."
Comment #24
xmacinfoOK. Let's mark this fixed. :-)
Comment #25
webchickEr. Well assuming that Garland is not the only contributed theme that explicitly prints out the title attribute like this (and I highly doubt that's the case), the change needs to be mentioned at http://drupal.org/update/theme/6/7 (with a before/after code snippet) so that themers can make similar adjustments in their own theme. Otherwise this anti-pattern will continue to propogate, since it's what Drupal core has been doing for years.
Comment #26
webchickYou can also (and are encouraged to!) add it to some sort of "Theme best practices" document if such a thing exists in the handbook.
But seriously, this needs to be documented somewhere other than one of the 13K random issues in the Drupal core issue queue. :P
Comment #27
geerlingguy CreditAttribution: geerlingguy commentedSpeaking of theming best practices, is there a doc somewhere for that? If there isn't there should be one. I know there's some sort of coding best practices, but that's not all that visible to designers/themers...
Comment #28
LeeHunter CreditAttribution: LeeHunter commentedTheming best practises are covered here: http://drupal.org/node/341707
Comment #29
Everett Zufelt CreditAttribution: Everett Zufelt commentedAdded the following to Designing Accessibility into Themes http://drupal.org/node/506866 in the theming guide.
Do not repeat redundant information in title attributes. Using the title attribute in a link can be a good way to communicate information about the link to assistive technology users. However, if the information in your title attribute presents the same information that is in the linked text, or does not accurately describe the link then remove it or change the text in the title attribute.
Comment #30
Everett Zufelt CreditAttribution: Everett Zufelt commented