Add 'title' tags to CHtml linkTag and image methods of CHtml.php

All generated hyperlinks and images need the title attributed added.

Titles are not decoration (providing "tool tips" is a side-effect).

They are required DOM elements and help sites conform with the W3C WAI-aaa and Section 508 standard – most automated validators miss title when the DOC Type is "transitional."

One of the benefits of including title is that screen readers can read these to the sight-impaired and they can be useful to those stuck on mobile devices.

For example:

<a href="">Yii Framework</a>

should be:

<a title="Yii Framework" href="">Yii Framework</a>

public static function linkTag( . . . , $title, . . .)

public static function image&nbsp; ( . . . , $title, . . .)


CHtml is a static class that provides a collection of helper methods 

 for creating HTML views.


 . . . /yii/framework/web/helpers/CHtml.php

You can specify a title by passing a 'title' element in the html option parameter. We are not going to change the methods with the new title parameter because it would break backward compatibility.

Thanks for reminding me about the flexibility of Yii.  Of course I can add the 'title' attribute using htmloptions, and I will; I also appreciate the necessity for maintaining backward compatibility.


I read your post. I’m also interested in the screen reader part.

The title-tag part seems something that can be done, but what about things like the search/filter boxes on top of a datagrid view, along with the buttons on the right and?

When I try to tab through a bacis Yii app, nothing gets selected except for a few menu items.

Do you perhaps know a solutions?