abbr-design-pattern: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
(acessibility)
Line 102: Line 102:
</pre>
</pre>


==Acessibility issues==
==Accessibility issues==


Ironically, this pattern while machine readable for browsers compatible with microformats is not accessible for screenreaders when referring to a date. Therefore:
Ironically, this pattern while machine readable for browsers compatible with microformats is not accessible for screenreaders when referring to a date. Therefore:
Line 113: Line 113:
</pre>
</pre>


would be read by jaws as
would be read by Jaws as


<pre>
<pre>
Line 119: Line 119:
</pre>
</pre>


The [http://www.webstandards.org/2007/04/27/haccessibility/  acessibility task force] from web standarsd.org recommends:
The [http://www.webstandards.org/2007/04/27/haccessibility/  accessibility task force] from webstandards.org recommends:


<pre>
<pre>

Revision as of 11:42, 19 May 2007

Abbr design pattern

Purpose

How to use it

  • enclose the human-friendly text that you want to make machine readable with <abbr>
  • as per the class-design-pattern, add the appropriate class attribute to the abbr element
  • add a title attribute to the abbr element with the machine readable data as the value

Example

The datetime-design-pattern formally encodes (the notoriously unparsable) datetimes into an abbr element.

Before:

The party is at 10 o'clock on the 10th.

After:

The party is at 
<abbr class="dtstart" title="20051010T10:10:10-0100">10 o'clock on the 10th</abbr>.

Alternative presentations

Note that the following are all equivalent, to a microformat parser:

<span class="dtstart">20070501</span>

<span class="dtstart">2007-05-01</span>

<abbr class="dtstart" title="20070501">1 May 2007</abbr>

<abbr class="dtstart" title="2007-05-01">1 May 2007</abbr>

<abbr class="dtstart" title="20070501">1st May 2007</abbr>.

<abbr class="dtstart" title="20070501">May 1st 2007</abbr>.

<abbr class="dtstart" title="20070501">The first of May, 2007</abbr>.

<abbr class="dtstart" title="20070501">2007-05-01</abbr>.

<abbr class="dtstart" title="20070501">Tuesday, 1 May 2007</abbr>

<abbr class="dtstart" title="20070501">2007, day 121</abbr>

<abbr class="dtstart" title="20070501">May Day, 2007</abbr>

<abbr class="dtstart" title="20070501" lang="FR">1er mai, 2007</abbr>

<abbr class="dtstart" title="20070501" lang="ES">1 de mayo, 2007</abbr>

and the following may be used in, say, a list, table, or page, headed "2007":

<abbr class="dtstart" title="20070501">1 May</abbr>

Discussion

This discussion is culled from here. Consider two possible uses for the abbr-design-pattern:

  1. using ABBR to encode machine readable data around human readable data
    <abbr class="dtstart" title="20051010T10:10:10-0100">10 o'clock on the 10th</abbr>
    
  2. using ABBR to encode more formal human data around something less formal
    <abbr class="author" title="Danny Ayers">Danny</abbr> 
    

Use #1 is encouraged if there's a reasonable need for it. Use #2 is discouraged under the Don't Repeat Yourself principle, as: "#2 is a case of *more* information being invisibly present, namely, the last name in this case. If someone is not willing to make some information visible, then we shouldn't be encouraging them to store that information invisibly, for all the same reasons that invisible metadata is bad/futile in the first place."

I'd like to delete this below, as the points are covered above

  • Theoretically, this could be done with almost any HTML element. But is it a good idea? If it's not, is abbr the only one? DavidJanes
  • abbr-design-pattern should be avoided, if possible. RobertBachmann
    • why, or under what circumstances? For example, it is quite useful with datetimes. Should there not be other potentially analogous situations? DavidJanes
    • Under circumstances where the text in the title would be gobbledegook if read by a screenreader. JAWS and other screenreaders use title attributes from abbr, when used properly (as in this example from the WCAG group), to pronounce words which would otherwise be unreadable or confusing. Using machine data such as datetime as a title is an bending of the dictionary definition of abbreviation (contraction by ommision or initialisation, applied at the word and not semantic level), this may not be a great issue in itself, but if screen readers are unable to turn title content into something comprehensible, this will lead to accessibility failures.
<p>Sugar is commonly sold in 5 <abbr title="pound">lb.<abbr> bags.</p>
<p>Welcome to the <abbr title="World Wide Web">WWW</abbr>!</p>

Accessibility issues

Ironically, this pattern while machine readable for browsers compatible with microformats is not accessible for screenreaders when referring to a date. Therefore:

we have a party in 
<abbr class="dtstart" title="20070312T1700-06">
 March 12, 2007 at 5 PM
</abbr>

would be read by Jaws as

we have a party at Twenty million seventy-thousand three-hundred twelve tee seventeen-hundred dash zero six. 

The accessibility task force from webstandards.org recommends:

<span class="dtstart" title="20070312T1700-06">
 March 12, 2007 at 5 PM, Central Standard Time
</span>

or

<span class="dtstart">
 March 12, 2007 at 5 PM, Central Standard Time
 <span class="value" title="20070312T1700-06"></span>
</span>

see more at abbr-design-pattern-issues and [1]

See Also