WordPress.org

Make WordPress Core

Opened 5 months ago

Closed 3 months ago

Last modified 3 months ago

#23250 closed enhancement (wontfix)

make_clickable is not creating title attribute

Reported by: Confridin Owned by:
Priority: normal Milestone:
Component: Formatting Version: 3.5
Severity: minor Keywords:
Cc:

Description

Hi,

I discovered the make_clickable function a few time ago. It converts URI, www, ftp and email addresses into links. The regex works fine but doesn't add the title attribute to the link.

For exemple, here is a sample texte

this is a text with a link : http://www.website.com

With make_clickable, a link is added :

this is a text with a link : <a href="http://www.website.com">http://www.website.com</a>

But a correct html link should contains a title attribute, like this

this is a text with a link : <a href="http://www.website.com" title="http://www.website.com">http://www.website.com</a>

The issue comes from those functions (into wp-includes/formatting.php
_make_web_ftp_clickable_cb
_make_url_clickable_cb
_make_email_clickable_cb

_make_url_clickable_cb
This code

return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix;

shoulde be replaced by

return $matches[1] . "<a href=\"$url\" title=\"$url\" rel=\"nofollow\">$url</a>" . $suffix;

_make_web_ftp_clickable_cb
This code

return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret";

shoulde be replaced by

return $matches[1] . "<a href=\"$dest\" title=\"$dest\" rel=\"nofollow\">$dest</a>$ret";

_make_email_clickable_cb
This code

return $matches[1] . "<a href=\"mailto:$email\">$email</a>";

shoulde be replaced by

return $matches[1] . "<a href=\"mailto:$email\" title=\"$email\">$email</a>";

Do you think it should be corrected ?

Regards,

Daniel Roch.

Change History (10)

comment:1 scribu5 months ago

  • Keywords reporter-feedback added

What's the benefit of duplicating the URL in the title attribute? There can surely be no SEO benefit.

comment:2 Confridin5 months ago

The title attribute is used for accessibility, including several softwares using it to read a link for blind people.

It is also recommanded in the W3C standard.

comment:3 Confridin5 months ago

  • Keywords reporter-feedback removed

comment:4 helen5 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

The link text would be read by a screenreader - no need for a title, especially one that doesn't give any more information. Unnecessary title attributes are actually quite detrimental for accessibility: http://www.rnib.org.uk/professionals/webaccessibility/wacblog/Lists/Posts/Post.aspx?id=38

comment:5 Confridin5 months ago

  • Keywords dev-feedback added
  • Resolution wontfix deleted
  • Status changed from closed to reopened

Thanks for your answer Helen. For urls links, it really makes sense.

Should email and FTP links use a meaningful title attribute, like "send an email to" or "ftp connexion to" ? (for _make_web_ftp_clickable_cb and _make_email_clickable_cb).

comment:6 SergeyBiryukov5 months ago

  • Component changed from General to Formatting
  • Milestone set to Awaiting Review

comment:8 esmi4 months ago

Title attributes are almost always a terrible idea

Loudly seconded!

Most experienced screen reader users use their software in non-verbose mode - which means that title attribute rendering is turned off. As an aside, this is almost certainly the result of sites in the past using title attributes for keyword stuffing which resulted in lots of unwanted "noise".

Voice recognition (VR) users and other sighted keyboard navigators (e.g. switch users) have absolutely no access to the title attribute.

tl;dr: The title attribute should never be relied upon to convey important information. If it's important enough to be added to a page, then (ideally) it should be in clear text where everyone can see it.

comment:9 Confridin3 months ago

  • Keywords dev-feedback removed
  • Resolution set to wontfix
  • Status changed from reopened to closed

Ok, i understand that it may hurt usability.

comment:10 helen3 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.