The Read More link for a teaser has the same text for every teaser. WAI AA requires a unique title if the text is not unique but the title just repeats Read More as the verbose "Read the rest of this posting.". Make the title unique by appending the title.

In node.module, change node_link from:

'attributes' => array('title' => t('Read the rest of this posting.'))

to:

'attributes' => array('title' => t('Read the rest of ' . $node->title))

petermoulding.com/web_architect

Comments

stevenpatz’s picture

Version: 5.x-dev » 7.x-dev
webchick’s picture

Version: 7.x-dev » 6.x-dev
Category: feature » bug
Status: Active » Needs review
StatusFileSize
new716 bytes

This sounds more like a bug than a feature request, and therefore can be fixed in 6.x (and possibly back-ported to 5.x).

The suggested fix is a bit dangerous though; node title could contain anything, so it needs to be check_plain()ed.

So this one adds the node title as placeholder in the string.

Freso’s picture

Status: Needs review » Needs work

Using my fresh D6 CVS install, I generated a bunch of (= 100) nodes with Devel Generate and went and checked the text, which said Read this posting.
I then tried to apply the patch, which went cleanly, refreshed the page and now properly got Read this [...].. However, trying with the title !"#€%&/()=?`><, I get this: title="Read the rest of !&amp;quot;#€%&amp;amp;/()=?`&amp;gt;&amp;lt;." - notice the doubly escaped ampersands! (The code for the <h2> title itself is title="!&quot;#€%&amp;/()=?`&gt;&lt;" - no doubly escaped ampersands.)

Freso’s picture

Status: Needs work » Needs review
StatusFileSize
new726 bytes

I've tried digging into the API and the code, and for all I can tell, node_link() inherits a call to l() from hook_link(), which runs the text (including attributes) through check_plain(). Which means that using @ is superfluous, and using ! should do fine. But I am must admit that I haven't been able to locate any actual references in any functions or anything, but, well, yes.

I've attached a patch with ! instead of @, please review and see if there's anywhere this isn't escaped.

webchick’s picture

Status: Needs review » Reviewed & tested by the community

Ah-ha, I had forgotten about the check_plain() in l(). Thanks, Freso!

Looks like this is good to go.

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks. I also added a comment that the title gets escaped later, so people will not fix this "bug".

peterx’s picture

The line
'attributes' => array('title' => t('Read the rest of !title.', array('!title' => $node->title)))
works in Drupal 5.2 and is in use on http://petermoulding.com.

Thank you for fixing the last WAI issue for Drupal and the modules in use on my site.

Anonymous’s picture

Status: Fixed » Closed (fixed)