1 (edited by sirena 2006-04-06 04:52)

Topic: Simple request: support for 'title' tag in a href links on menu etc

This is a simple request to enhance the accessibility and usability of PunBB, at least in one small way.

At the moment no links in the standard PunBB forum menu, or any links anywhere else in punBB for that matter, support the 'title' variable in their href code.

The 'title' variable in HTML is very handy for enabling information about the link to be displayed when, for example, you hover the mouse over a specific link.

So for example in the main menu of punBB at the moment you get a link with HTML like this:

<a href="userlist.php">User list</a>

whereas if you had a link that used the 'title' variable like this:

<a title="Search or browse a list of forum users" href="userlist.php">User list</a>

you would have a much more informative link which displayed 'Search or browse a list of forum users' when the mouse hovered over it, or when a text only screen-reader encountered that link. It is the same concept as using 'alt' tags for images, and is very standard HTML.

I can only add the 'title' element to those links I manually add via HTML inserted into the menu via the Administration > Options page.

But it would be better if we had some way of modifying the code behind the main menu links to include this 'title' information.  Short of hacking the PHP pages directly, there seems no way of getting that 'title' tag into the main menu items.

Or am I just betraying my ignorance of CSS here?

Can I get the same result by playing with the CSS defined for each menu item ID, like the id="navindex", id="navuserlist" etc CSS IDs used in the menu, and somehow do something with punBB style sheets to achieve the same thing? :

On a related note, punBB also doesn't seem to set any alt text for any images anywhere, for eg here, for the avatar displayed in a post:

<img src="img/avatars/2.gif" width="64" height="80" alt="" />

You should at least populate that alt tag with something like 'avatar image', I think. Improves accessibility and usability a bit.

2

Re: Simple request: support for 'title' tag in a href links on menu etc

sirena wrote:

you would have a much more informative link which displayed 'Search or browse a list of forum users' when the mouse hovered over it, or when a text only screen-reader encountered that link. It is the same concept as using 'alt' tags for images, and is very standard HTML.

You'd be hard pushed to find someone who doesn't know what 'User List' means.

I don't think there is a single link that needs a title explaining it, and titles everywhere needlessly bumps up the page size.

Re: Simple request: support for 'title' tag in a href links on menu etc

You'd be hard pushed to find someone who doesn't know what 'User List' means.

I don't think there is a single link that needs a title explaining it, and titles everywhere needlessly bumps up the page size.

True about 'user list' being understandable, but in general I think the "title" tag adds a level of utility to links that is desirable, with barely any impact on page payload. Every A HREF on site wouldn't need it, just those that are important (like navigation links), or which would benefit from some additional information cue being given to the user.

People appreciate small usability enhancements like that. I've been using the "title" tag for years and it's sad to see it drop off that part of the site that may use Pun.

Oh, and while I came across many ways to implement "title" purely in CSS, to produce the equivalent 'tooltip' functionality, I couldn't get it to happen by modifying the style sheet alone to tell it to display specific text against a specific Pun CSS ID or Class element, alas.

Most of the CSS-based approaches I found required the target HTML to have <span> or other elements surrounding the page link, and the content of the tooltip needed to reside in the HTML between those elements. Which of course I can only implement by directly modifying Pun's PHP, which I want to avoid.

Oh well, it's only a minor wishlist item.  I can live without it.

4

Re: Simple request: support for 'title' tag in a href links on menu etc

The problem is when you are designing with people using screen readers in mind you have to be conscious of not creating pointless noise. They are quite likely to find unnecessary titles a pain in the ear and just a general nuisance in that they slow down navigating the site. That is one reason why a large number of screen reader users, so I'm told, surf with the title attribute reading capability deactivated. I tend to think that if you need a title tag to explain link text then you really need to come up with better link text.

Having said that, there are some instances where titles are useful. For example take the front page of PunBB.org where the names of topics in the new topics list are truncated. Another example would be the help links for bbcode, a title saying they link opens a new window is sensible. A further example would be user names in posts, a title saying that the link goes to the users profile might be sensible since it isn't obvious what the link target is. It really comes down to using titles where they add something useful but not using them everywhere just for the sake of it.

As for the Alt atribute (its an attribute not a tag). Thats will be fixed in the next version.

As for adding additional spans to links to contain explanatory text. There is no cross browser way of doing it just using css. You can however cheat in some instances by editing the language files so they would read for example 'link text <span>some explanation</span>',.

5 (edited by AudioGames.net 2006-04-07 12:11)

Re: Simple request: support for 'title' tag in a href links on menu etc

Hi,

Just read this topic and http://punbb.org/forums/viewtopic.php?id=5684. I'd really like to have the ability to add ALT-attributes to [IMG] too because of obvious accessibility issues. Is there a simple line of code that I can add/change somewhere which lets me do this (since I'm too eager to wait for the next version...)?

Greets,

Richard

Re: Simple request: support for 'title' tag in a href links on menu etc

A standard ALT attribute ot one that you define like [img=altxtxt ]imglink[/img] ?

Re: Simple request: support for 'title' tag in a href links on menu etc

Hi,
AudioGames and I fixed the alt-thing. We added a sort of BBcode based addition with alt-text conversion in parser.php
Now users can add alternatives for images, just like elbekko suggested:

google logo

For a demonstration or the simple php patterns (place it before the return $text of the message in the parser, don't forget to return it after an update!), have a look here:
http://www.accessibility.nl/games/forum … .php?id=16

8

Re: Simple request: support for 'title' tag in a href links on menu etc

I put in a request to head office for bbcode to be altered for 1.3 to allow exactly this for the same reasons as you've done it (I can't do regex, not enough brain cells). In the meantime I will splice your code into 1.3 for testing. Shouldn't there be a default e.g. "No descrption provided" or something similar?

Re: Simple request: support for 'title' tag in a href links on menu etc

Regex always pushes my braincells to stay active for about 20 hours on end. Can't get no sleep after five minutes of regex-mode! smile

Well...actually, I added this small piece of code at line 50 of the parser...right after the lowercase-conversion. Of course there are much nicer ways to do this, but unfortunately I did not have time to find out, what's the neatest thing to do.

// sander edit -- notify when no alt is provided...
$pattern = '/\[img\]\s*(.*?)\s*\[\/img\]/';
$replace = "[img]$1[/img]\nYou did not provide an ALT-attribute...please edit this message and make the image accessible! Please read the document http://www.accessibility.nl/games/forum … .php?id=16 for the code!\n";
$text = preg_replace($pattern, $replace, $text);

This places a message below the BBcode for images.

For this forum, accessibility is a must. I can imagine a more user-friendly way of telling a user right after submitting a post that the tag was left empty. However, adding a default "no description provided" again leaves the same old problem that it's possible to add tags, but also to forget them...people take the time to add an image, but often just don't take the time for the description...

Great to see you put in a request! And keep up the great work with this uber-user-friendliest forum!

btw, demonstration is here: http://www.accessibility.nl/games/forum … pid=44#p44

Re: Simple request: support for 'title' tag in a href links on menu etc

I added the code and added an example parser in a .zip:
http://www.accessibility.nl/games/forum … d=170#p170