Why title = $title is Bad

The [title attribute](http://www.w3.org/TR/html4/struct/global.html#h-7.4.3 "Further reading, Title Attribute definition from the W3C, 'The Global Structure of an HTML document'") is something that's been around longer than most of us can remember and its become one of the most commonly used, if not abused, attributes.

As far back as I care to look (4.7, 5 & 6) ) Drupal's default node template has included a title attribute in the node title link (the one that normally appears on teasers wrapped in an <h2> heading). Drupal hasn't learnt from this past mistake either.

For clarities sake lets take a quick peek at the what I'm talking about, the following code is from Drupal 6 node.tpl.php. For those who don't know, `$title` is the node title, e.g. for this node its "*Why title = $title is Bad*".

<h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>

This is a poor implementation of the title attribute and rallies against its original intent—to provide *additional* information. That may be so, but surely the current implementation isn't *that* bad, more like a harmless addition. I beg to differ.

1. Its Redundant

We simply don't need it.

2. Screen readers configured to read title attributes will repeat the title

Which is annoying. Also see 1.

As far back as 1998 its was suggested to use the title attribute to add details about the kind of information to be found on the destination page and how it relates to the anchor text and to the context of the current page [^1].

Why then is Drupal core not doing this, or at least, simply [omit the needless](http://www.bartleby.com/141/strunk5.html#13) attribute. And why are so many [contributed](http://drupal.org/project/zen) [starter](http://drupal.org/project/framework) [themes](http://drupal.org/project/clean) [following](http://drupal.org/project/foundation) [suit](http://drupal.org/project/tendu). [Of](http://drupal.org/project/genesis) [course](http://drupal.org/project/basic), [not](http://drupal.org/project/atck) [everyone](http://drupal.org/project/beginning) [is](http://drupal.org/project/flexible) [playing](http://drupal.org/project/hunchbaque) [along](http://drupal.org/project/bluetrip).

Last updated 3rd December, 2017 - 6:36pm

Authored by Jeff Burnz on