2

This issue is about accessibility (508) compliance.

I have a link with a title attribute that shows up in a tool tip. Within that tool tip is the abbreviation "Dr." In order to have a screen reader say "doctor" instead of "dur", I have to wrap the abbreviation in an <abbr> tag like so in line two:

<a class="fancybox" href="#brenda-jones-harden" 
title="View <abbr title='Doctor'>Dr.</abbr> Brenda Jones Harden's bio">
<img src="https://content.cleverex.com/hslc/tta-system/ehsnrc/btt/images/no-photo.jpg" 
alt="No Photo Available" height="96" width="80"><span class="two_liner">
<abbr title='Doctor'>Dr.</abbr> Brenda Jones Harden</span></a>

However, when I use the abbr tag inside the title tag the pop-up tool tip reads:

"View <abbr title='Doctor'>Dr.</abbr> Brenda Jones Harden's bio"

I believe this means that I can't nest the abbr tag inside an alt or title attribute. Doing so will always have the tag showing as regular text. Do you agree? Is there a workaround? I can't find the answer to this anywhere, so I'm submitting my first-ever question to Stack Overflow. Please excuse me if I don't quite have the eloquence of most of your other posts.

RyanS
  • 627
  • 1
  • 10
  • 26
LeraA
  • 241
  • 1
  • 4
  • 13
  • I think your best bet is to write it like 'Doctor'. – 11684 Feb 25 '13 at 21:48
  • 3
    Even if you could, how would anyone see the full version of the abbreviation if this is displayed inside a system tooltip? – nice ass Feb 25 '13 at 21:51
  • 1
    It might also be worth noting that [the title attribute for accessibility is pretty much worthless](http://www.paciellogroup.com/blog/2013/01/using-the-html-title-attribute-updated/), so you might be going overboard (some even argue to the point of counterproductivity) in your attempt to use `` inside any title attribute. – Shauna Feb 25 '13 at 21:55
  • Writing it out is a good idea, and the client agrees. I agree that the abbr tag inside a tool tip seems like overkill. In this case it is solely for the use of the user who has their screen reader set to read the abbr tag contents instead of the original text. It's not even the default option. – LeraA Feb 25 '13 at 21:57

1 Answers1

1

Short answer: No, you can't nest a tag in an attribute. http://www.w3.org/TR/html5/dom.html#attr-title

I recommend writing just Doctor, as was already mentioned in the comments :)

Jaco Koster
  • 497
  • 3
  • 14