Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#17349 closed enhancement (wontfix)

Missing title attribute in anchor tag

Reported by: ksantoshp's profile ksantoshp Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1.2
Component: General Keywords:
Focuses: Cc:

Description

From usability point of view and as per WCAG guideline, each anchor tag should have title attribute.

In few of wordpress core files there are few anchor tag markup, which missed this title attribute.

For example in wp-includes/category-template.php file on line number 469, there is code as below:

$output .= '<li><a href="' .  get_bloginfo( 'url' )  . '">' . $show_option_all . '</a></li>';

It is good if there is title attribute like below

$output .= '<li><a href="' .  get_bloginfo( 'url' )  . '" title="' .$show_option_all. '">' . $show_option_all . '</a></li>';

Change History (6)

#1 @ksantoshp
13 years ago

  • Summary changed from s fsf to Missing title attribute in anchor tag

#2 @toscho
13 years ago

  • Cc info@… added

Could you name the exact reference to this guideline? Usually, redundant title attributes are anything but of useful. For users of a screen reader they are very annoying and useless.

Title attributes are useful for links withe the same anchor text and different targets (read more for example). That is not the case here.

#3 @scribu
13 years ago

What toscho said.

#4 @scribu
13 years ago

  • Keywords reporter-feedback close added; ui-feedback ux-feedback removed

#5 @ksantoshp
13 years ago

Here is the guidline http://www.w3.org/TR/WCAG20/ .

@toscho I accept your point

"Title attributes are useful for links withe the same anchor text and different targets".
but still can we have option, through which I can add title attribute to <a> tag.
I found one option in wp-includes/link-template.php on line number 1594 and 1595 and code is as below

$attr = apply_filters( 'next_posts_link_attributes', '' );
		return '<a href="' . next_posts( $max_page, false ) . "\" $attr>" . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label) . '</a>';

This code is to show pagination link "next". I like the idea of $attr with filter. And I used it as below in my theme's function.php

add_filter( 'next_posts_link_attributes', 'rt_next_posts_link_attributes' );

function rt_next_posts_link_attributes() {
    return ' title="next"';
}

With above code I inserted title attibut for "next" link.

My suggestion is that, can we have $attr and filter combination for those anchor tags, where it really needed.

#6 @scribu
13 years ago

  • Keywords reporter-feedback close removed
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Closing this ticket.

Feel free to open a new one, asking for an attributes filter on certain functions, if you can provide solid use-cases, besides duplicating the title attribute.

Last edited 13 years ago by scribu (previous) (diff)
Note: See TracTickets for help on using tickets.