<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Yahoo! Accessibility Library</title>
	<atom:link href="http://yaccessibilityblog.com/library/index.php/feed" rel="self" type="application/rss+xml" />
	<link>http://yaccessibilityblog.com/library</link>
	<description>Accessible coding and research library from the Yahoo! Accessibility Lab</description>
	<lastBuildDate>Sat, 31 Mar 2012 17:43:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Defining isAccessibilityElement in your iOS Application</title>
		<link>http://yaccessibilityblog.com/library/isaccessibility-ios-app.html</link>
		<comments>http://yaccessibilityblog.com/library/isaccessibility-ios-app.html#comments</comments>
		<pubDate>Wed, 28 Mar 2012 18:27:39 +0000</pubDate>
		<dc:creator>Ted Drake</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[isAccessibilityElement]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://yaccessibilityblog.com/library/?p=1291</guid>
		<description><![CDATA[Control the granularity of items that a user can interact with in an iOS application with isAccessibilityElement. ]]></description>
			<content:encoded><![CDATA[<p>I remember the first time I tested an iPad app for accessibility. <a href="http://finance.yahoo.com">Yahoo! Finance</a> was preparing to launch <a href="http://mobile.yahoo.com/ipad#finance">MarketDash</a> and wanted to make sure it was as accessible as the web site. With VoiceOver enabled and a <a href="http://www.youtube.com/watch?v=qJc9vh-hy6E">Flip cam set to record</a>, Victor Tsaran and I began exploring the app. The most confusing bug we found was an empty article page.<a href="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/marketdash-article.png"><img src="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/marketdash-article-229x300.png" alt="screenshot of an article within MarketDash" title="marketdash-article" width="229" height="300" class="alignright size-medium wp-image-1302" /></a></p>
<p>It was impossible to read a news article with VoiceOver enabled. It worked fine with VoiceOver disabled and I could read the article in Safari. However, the article within MarketDash was a black hole. </p>
<p>The Finance engineers added confusion by responding with  &quot;we needed to remove the accessibility setting.&quot; In other words, they made it more accessible by removing accessibility. Perhaps you&#8217;ve had a similarly confusing experience.</p>
<p><span id="more-1291"></span></p>
<h3>What is isAccessibilityElement?</h3>
<p>This article introduces <a href="https://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/iPhoneAccessibility/Making_Application_Accessible/Making_Application_Accessible.html#//apple_ref/doc/uid/TP40008785-CH102-SW9">isAccessibilityElement</a>, how it determines what elements are interactive, and how it can easily create accessibility problems. Fortunately, this is an easy concept to understand and fix in your applications.</p>
<p><a href="http://www.flickr.com/photos/dreamwhile/4519283854/" title="matryoshka by dreamwhile, on Flickr"><img src="http://farm5.staticflickr.com/4061/4519283854_b5c08e801e_n.jpg" width="320" height="214" alt="matryoshka dolls"  class="alignright"></a>To understand isAccessibility,  imagine  playing with some <a href="http://en.wikipedia.org/wiki/Matryoshka">Russian matryoshka dolls</a>. The largest doll contains a set of nested dolls that progressively get smaller. When you close the larger doll, you are not able to play with the smaller dolls. When you open a larger doll, you are able to access and play with a smaller doll. This is true until you get down to the smallest, most granular doll.</p>
<p>isAccessibility determines what element can be focused when VoiceOver is enabled. Placing it too high, i.e. the parent, blocks focus on the child elements. The article page on MarketDash uses a custom view that contains a web view. Originally the custom view had isAccessibiltyElement set to YES, which made it impossible to read the web view. The solution was to set isAccessibilityElement on the custom view to NO and set the web view to YES.</p>
<div id="attachment_1287" class="wp-caption alignleft" style="width: 310px"><a href="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/marketdash-article-parent.jpg"><img src="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/marketdash-article-parent-300x271.jpg" alt="MarketDash with incorrect Accessibility setting"  width="300" height="271" class="size-medium wp-image-1287" /></a><p class="wp-caption-text">The parent container has isAccessibility in this illustration</p></div>&nbsp;<div id="attachment_1286" class="wp-caption alignleft" style="width: 310px"><a href="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/marketdash-article-children.jpg"><img src="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/marketdash-article-children-300x271.jpg" alt="MarketDash article with Accessibility set correctly"  width="300" height="271" class="size-medium wp-image-1286" /></a><p class="wp-caption-text">This illustration shows the web view and control bar with Accessibility enabled</p></div>
<p style="clear:left">This problem is also seen frequently on <a href="http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/AboutTableViewsiPhone/AboutTableViewsiPhone.html#//apple_ref/doc/uid/TP40007451">Table Views</a>. The thumbnail view in the Flickr application is a good example. We want the user to access the individual images, which sit inside a <a href="http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITableViewCell_Class/Reference/Reference.html#//apple_ref/occ/cl/UITableViewCell">UITableViewCell</a>, which sits inside a <a href="http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITableView_Class/Reference/Reference.html#//apple_ref/occ/cl/UITableView">UITableView</a>. The solution is to set isAccessibilityElement to NO on the table and cell. You&#8217;ll also need to set the thumbnails to YES.</p>
<div id="attachment_1290" class="wp-caption alignleft" style="width: 200px"><a href="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/isAccessibility-table.jpg"><img src="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/isAccessibility-table-220x300.jpg" alt="Accessibility set on table"  width="190"  class="size-medium wp-image-1290" /></a><p class="wp-caption-text">Setting Accessibility on parent makes it impossible to select a row or thumbnail</p></div>&nbsp;<div id="attachment_1289" class="wp-caption alignleft" style="width: 200px"><a href="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/isAccessibility-row.jpg"><img src="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/isAccessibility-row-220x300.jpg" alt="isAccessibility set on row"  width="190"  class="size-medium wp-image-1289" /></a><p class="wp-caption-text">The row has Accessibility, which makes it impossible to select a thumbnail</p></div>&nbsp;<div id="attachment_1288" class="wp-caption alignleft" style="width: 200px"><a href="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/isAccessibility-item.jpg"><img src="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/isAccessibility-item-220x300.jpg" alt="Accessibility set on thumbnail"  width="190" class="size-medium wp-image-1288" /></a><p class="wp-caption-text">placing Accessibility on thumbnail makes it interactive</p></div>
<h3 style="clear:left">Setting isAccessibilityElement</h3>
<p>There is a default setting for  isAccessibilityElement and you&#8217;ll only need to set this in special circumstances. </p>
<blockquote><p>
The default value for this property is NO unless the receiver is a standard UIKit control, in which case the value is YES.</p>
<p>Assistive applications can get only information about objects that are represented by accessibility elements. Therefore, if you implement a custom control or view that should be accessible to users with disabilities, you should set this property to YES. The only exception to this practice is a view that merely serves as a container for other items that should be accessible. Such a view should implement the UIAccessibilityContainer protocol and set this property to NO.</p>
<p><cite><a href="http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIAccessibility_Protocol/Introduction/Introduction.html">UIAccessibility Protocol Reference</a> &#8211; Apple</cite>
</p></blockquote>
<h4>Setting isAccessibilityElement via Interface Builder</h4>
<div id="attachment_1285" class="wp-caption alignnone" style="width: 688px"><img src="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/xcode-accessibility-option.png" alt="screenshot of Xcode and the accessibility option"  width="678"  class="size-full wp-image-1285" /><p class="wp-caption-text">The thumbnail in this TableViewCell has Accessibility enabled in Interface Builder</p></div>
<p>Open the Accessibility group  in the inspector panel of XCode. Highlight the object that needs to be modified and select the Accessibility Enabled option. </p>
<h4>Setting isAccessibilityElement in Objective C</h4>
<p>You will often need to set the accessibility dynamically. Apple&#8217;s sample application <a href="https://developer.apple.com/library/ios/#samplecode/Formulaic/Introduction/Intro.html">Formulaic</a> includes various accessibility settings. In this example, the code turns off isAccessibilityElement within the implementation specifications. There are only two options for this setting &#8220;YES&#8221; or &#8220;NO&#8221;.</p>
<div class="codesnip-container" >
<div class="c codesnip" style="font-family:monospace;"><span class="co1">// if a UIView implements the container protocol, it cannot be an accessible element</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span>BOOL<span class="br0">&#41;</span>isAccessibilityElement<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw1">return</span> NO<span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>You can also set this during instantiation. This example comes from a lecture given by Chris Fleizach, available on Stanford University’s iTunesU – <a href="http://itunes.apple.com/us/itunes-u/developing-apps-for-ios-hd/id395605774">Developing Apps for iOS 2010</a> (look for lecture #18). </p>
<div class="codesnip-container" >
<div class="c codesnip" style="font-family:monospace;"><span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>setupBowlingBall<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; bowlingBall <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>BowlingBall alloc<span class="br0">&#93;</span> initWithFrame<span class="sy0">:</span>CGRectZero<span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &#8230;<br />
&nbsp; &nbsp; <span class="me1">bowlingBall</span>.<span class="me1">isAccessibilityElement</span> <span class="sy0">=</span> YES<span class="sy0">;</span><br />
&nbsp; &nbsp; bowlingBall.<span class="me1">accessibilityTraits</span> <span class="sy0">=</span> UIAccessibilityTraitButton<span class="sy0">;</span><br />
&nbsp; &nbsp; …<br />
<span class="br0">&#125;</span></div>
</div>
<h3>Resources</h3>
<ul>
<li><a href="http://engineering.hoteltonight.com/improving-accessibility-support-in-hoteltonig">Improving Accessibility Support In HotelTonight For iOS </a></li>
<li><a href="http://yaccessibilityblog.com/library/ios-accessibilityhint-apps.html">Increase iOS Accessibility with Accessibility Hints</a></li>
<li><a href="http://mattgemmell.com/2010/12/19/accessibility-for-iphone-and-ipad-apps/">Accessibility for iPhone and iPad apps</a> by Matt Gemmell</li>
<li><a href="http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/iPhoneAccessibility/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008785-CH1-SW1">Apple’s Accessibility Programming Guide for iOS</a></li>
<li><a href="http://developer.apple.com/library/ios/documentation/uikit/reference/UIAccessibility_Protocol/">UIAccessibility Protocol Reference</a></li>
<li><a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIAccessibilityContainer_Protocol/Introduction/Introduction.html">UIAccessibilityContainer Protocol Reference</a></li>
<li><a href="http://developer.apple.com/library/ios/documentation/uikit/reference/UIAccessibilityElement_Class/Reference/Reference.html">UIAccessibilityElement Protocol Reference</a></li>
</ul>
<p>Feature image: <a href="http://www.flickr.com/photos/dreamwhile/4519283854/in/photostream/">Matryoshka</a>: <span class="ccIcn ccIcnSmall"><a href="http://creativecommons.org/licenses/by-nc-nd/2.0/"><img border="0" title="Attribution" alt="Attribution" src="http://l.yimg.com/g/images/cc_icon_attribution_small.gif"/><img border="0" title="Noncommercial" alt="Noncommercial" src="http://l.yimg.com/g/images/cc_icon_noncomm_small.gif"/><img border="0" title="No Derivative Works" alt="No Derivative Works" src="http://l.yimg.com/g/images/cc_icon_noderivs_small.gif"/></a></span> <a title="Attribution-NonCommercial-NoDerivs License" href="http://creativecommons.org/licenses/by-nc-nd/2.0/">Some rights reserved</a> by <a href="/photos/dreamwhile/">dreamwhile</a></p>
]]></content:encoded>
			<wfw:commentRss>http://yaccessibilityblog.com/library/isaccessibility-ios-app.html/feed</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>Increase iOS Accessibility with  Accessibility Hints</title>
		<link>http://yaccessibilityblog.com/library/ios-accessibilityhint-apps.html</link>
		<comments>http://yaccessibilityblog.com/library/ios-accessibilityhint-apps.html#comments</comments>
		<pubDate>Thu, 22 Mar 2012 14:00:34 +0000</pubDate>
		<dc:creator>Ted Drake</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[accessibilityHint]]></category>
		<category><![CDATA[accessibilityLabel]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[iOS]]></category>

		<guid isPermaLink="false">http://yaccessibilityblog.com/library/?p=1250</guid>
		<description><![CDATA[Use accessibilityHint in your iOS applications to give users more information about complex interactions and buttons.]]></description>
			<content:encoded><![CDATA[<p>Apple&#8217;s <a href="https://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/MobileHIG/Introduction/Introduction.html">iOS Human Interface Guidelines</a> encourage developers to create compelling, immersive mobile interfaces. The goal is to delight the user with an inventive interface that invites the user to touch and explore. Often times, this leads to designs with interactions that are not immediately understood. </p>
<p><span id="more-1250"></span></p>
<h3>The Problem</h3>
<p><a href="http://www.flickr.com/photos/draket/7000506965/" title="iOS accessibilityHint by Ted Drake, on Flickr"><img src="http://farm8.staticflickr.com/7239/7000506965_6c7cea7f02_n.jpg" width="320" height="240" alt="iOS accessibilityHint" class="alignright"></a>Many apps will use graphic icons to suggest available functionality. Unfortunately, these icons are not always made accessible to VoiceOver users. Other interactions take advantage of the natural reactions to swipe and pull on items. As VoiceOver users tend to explore by dragging their finger over the screen or using a single finger swipe to &#8220;tab&#8221; through the page, these interactions may not be discovered.</p>
<p>For instance, a list of items may be refreshed by pulling down, a button may list a selection title and provide a drop down to select an alternate, images can be scrolled, and text can be tapped to trigger playing music.</p>
<h3>The Solution</h3>
<p>Fortunately iOS provides a convenient solution: <a href="https://developer.apple.com/library/ios/#documentation/uikit/reference/UIAccessibilityElement_Class/Reference/Reference.html">accessibilityHint</a>. Ron Nicholson described <strong>UIAccessibiltyHint</strong> usage in his company&#8217;s iPhone apps:</p>
<blockquote cite="http://stackoverflow.com/questions/3673550/ios-accessibility-label-vs-hint">
<p>If you had a short help document for your app, it might show a picture of your app, with arrows pointing at the elements, and a small bubble caption on each of those arrows saying stuff like &quot;Stops playing annoying fart sounds&quot; and &quot;Changes fart loudness from silent to ear shatteringly gross&quot;. These would be your helpful &quot;hints&quot;.</p>
<p>    <cite><a href="http://stackoverflow.com/questions/3673550/ios-accessibility-label-vs-hint">iOS accessibility: label vs hint</a> &#8211; Stack Overflow</cite>
</p></blockquote>
<p>Developers need to carefully consider when an accessibilityHint is needed. Further, the hint should be short, declare the purpose, and not mention the gesture or type of object the user is interacting with. Apple&#8217;s <a href="https://developer.apple.com/library/ios/#DOCUMENTATION/UserExperience/Conceptual/iPhoneAccessibility/Making_Application_Accessible/Making_Application_Accessible.html">Accessibility Programming Guide</a> suggests using  a hint &#8220;only when the results of an action are not obvious from the element’s label&#8221;.  Matt Gemmell summarizes the art of creating good hints:</p>
<blockquote cite="http://mattgemmell.com/2010/12/19/accessibility-for-iphone-and-ipad-apps/"><p>
A good accessibility hint should describe the outcome of interacting with the control. It should not describe the actual means of interaction (like tapping or swiping), because there are multiple ways for a VoiceOver user to interact with your control, and you can’t predict which they’ll use. Hints should begin with a plural verb, if at all possible; for example, “Deletes the event”. Do not use a singular verb (such as “Delete the event”), because this will sound like an imperative (a command or instruction to the user).<br />
<cite><a href="http://mattgemmell.com/2010/12/19/accessibility-for-iphone-and-ipad-apps/">Accessibility for iPhone and iPad apps</a> &#8211; Matt Gemmell</cite>
</p></blockquote>
<h3>accessibilityHint Examples</h3>
<p>The following iPhone applications use accessibilityHint effectively.</p>
<h4>Hanging with Friends &#8211; Zynga</h4>
<p><img src="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/words-with-friends-150x150.jpg" alt="Words with Friends icon" title="words-with-friends" class="alignright" width="125" /></p>
<p><a href="http://hangingwithfriends.com/">Hanging with Friends</a> provides updates on other games you are playing. The button&#8217;s label includes the game&#8217;s name: &#8220;Play Words&#8221;. The button&#8217;s accessibilityHint lets you know it will either switch applications or install the game: &#8220;Switches to or intalls the game Words.&#8221;.</p>
<h4>Yahoo! Search for iPhone</h4>
<p><img src="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/search-300x120.jpg" alt="Yahoo categories view" title="Yahoo-search-categories" width="300" height="120" class="alignright size-medium wp-image-1259" />The <a href="http://itunes.apple.com/us/app/yahoo!-search/id361071600?mt=8&#038;ign-mpt=uo%3D4">Yahoo! Search app</a> has a scrolling view to choose various categories. While there are arrow icons that prompt the user to swipe for more options, they&#8217;ve also added accessibilityHint. In this case, the developers included the swipe action to make sure users know how to navigate. The accessibilityHint is &#8220;Swipe to get more categories.&#8221;.</p>
<h4>Yahoo! Finance for iPhone</h4>
<p><img src="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/finance-table-300x203.jpg" alt="Yahoo! Finance market data on iPhone" title="finance-table" width="300" height="203" class="alignright size-medium wp-image-1260" />The Major Indices table on the <a href="http://itunes.apple.com/us/app/yahoo!-search/id361071600?mt=8&#038;ign-mpt=uo%3D4">Yahoo! Finance app</a> lists the vaue and price on markets and stocks. The individual cells have an accessibilityLabel that compiles the displayed information into a useful string of text: &#8220;Nasdaq 3,065.27 down 13.05 or 0.42%&#8221;. The accessibilityHint lets the user know they will find more information about this market: &#8220;Displays more details.&#8221;.</p>
<h3>Implementing the accessibilityHint</h3>
<p>There are several options for adding an accessibilityHint  via Interface Builder or in the .m file.</p>
<h4>Using Interface Builder</h4>
<p><a href="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/xcode-acc-hint-label.png"><img src="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/xcode-acc-hint-label-300x217.png" alt="screenshot of Interface Builder in xCode" title="xcode-acc-hint-label" width="300" height="217" class="alignright size-medium wp-image-1256" /></a>The accessibility panel is located within the <strong>Identity Inspector</strong> column of XCode. This panel lets you set the various accessibility traits of objects inserted within the .xib or .storyboard files. This works best for static hints.</p>
<p>Apple&#8217;s sample app <a href="https://developer.apple.com/library/ios/#samplecode/Formulaic/Introduction/Intro.html">Formulaic</a> has a button with Label=&quot;Show table&quot;. We can add an accessibilityHint to let the user know the table will display the results of the equation: Hint=&quot;View equation results in tabular format.&quot;.</p>
<h4>Inserting at viewDidLoad</h4>
<p>Many developers will add accessibility attributes at the viewDidLoad stage. viewDidLoad is called after instantiation and outlet-setting, . Paul Hegarty explains this is &quot;an exceptionally good place to put a lot of setup code&quot; in his discussion of view life cycles (<a href="http://itunes.apple.com/itunes-u/ipad-iphone-application-development/id473757255">Stanford iTunesU: iPad and iPhone Application Development &#8211; Lecture 8</a>).  The previously mentioned Formulaic app sets an accessibilityHint on the stopwatch button at this stage.</p>
<div class="codesnip-container" >
<div class="c codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad <br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="co1">// update the graph view</span><br />
&nbsp; &nbsp; <span class="br0">&#91;</span>selfupdateGraphingView<span class="br0">&#93;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; <span class="co1">// set the hint for the stop watch button</span><br />
&nbsp; &nbsp; <span class="br0">&#91;</span>stopWatchsetAccessibilityHint<span class="sy0">:</span>@<span class="st0">&quot;Toggles animation.&quot;</span><span class="br0">&#93;</span><span class="sy0">;</span> &nbsp; &nbsp;</p>
<p>&nbsp; &nbsp; <span class="co1">// allow updates of graph</span><br />
&nbsp; &nbsp; shouldUpdateGraph <span class="sy0">=</span> YES<span class="sy0">;</span></p>
<p>&nbsp; &nbsp; <span class="br0">&#91;</span>superviewDidLoad<span class="br0">&#93;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<h4>Set accessibilityHint at Initialization</h4>
<p>Another option for adding an accessibilityHint is during initialization of an object. This example comes from a lecture given by Chris Fleizach, also available on Stanford University&#8217;s iTunesU &#8211; <a href="http://itunes.apple.com/us/itunes-u/developing-apps-for-ios-hd/id395605774">Developing Apps for iOS 2010</a> (look for lecture #18).  </p>
<div class="codesnip-container" >
<div class="c codesnip" style="font-family:monospace;"><span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>setupBowlingBall<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; bowlingBall <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>BowlingBall alloc<span class="br0">&#93;</span> initWithFrame<span class="sy0">:</span>CGRectZero<span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &#8230;<br />
&nbsp; &nbsp; <span class="me1">bowlingBall</span>.<span class="me1">accessibilityLabel</span> <span class="sy0">=</span> NSLocalizedString<span class="br0">&#40;</span>@<span class="st0">&quot;ball.label&quot;</span><span class="sy0">,</span> nil<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; bowlingBall.<span class="me1">accessibilityHint</span> &nbsp; <span class="sy0">=</span> NSLocalizedString<span class="br0">&#40;</span>@<span class="st0">&quot;ball.hint&quot;</span><span class="sy0">,</span> nil<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &#8230;<br />
<span class="br0">&#125;</span></div>
</div>
<p>This code also shows how you can localize your labels and hints using <a href="https://developer.apple.com/library/ios/#documentation/MacOSX/Conceptual/BPInternational/BPInternational.html#//apple_ref/doc/uid/10000171i">NSLocalizedString</a>. </p>
<h3>Action Items</h3>
<p>The majority of iOS apps can easily be made accessible by using a combination of accessibility attributes. Accessibility hints avoid vague interactions and make the application easier to understand and navigate. For more information, visit the following resources:</p>
<ul>
<li><a href="https://developer.apple.com/library/ios/#DOCUMENTATION/UserExperience/Conceptual/iPhoneAccessibility/Making_Application_Accessible/Making_Application_Accessible.html">Accessibility Programming Guide for iOS</a></li>
<li><a href="https://developer.apple.com/library/ios/#samplecode/Formulaic/Introduction/Intro.html">Formulaic</a> &#8211; accessible app tutorial from Apple</li>
<li><a href="http://disanji.net/iOS_Doc/#documentation/UIKit/Reference/UIAccessibility_Protocol/Introduction/Introduction.html">UIAccessibility Protocol Reference</a></li>
<li><a href="https://developer.apple.com/library/ios/#documentation/uikit/reference/UIAccessibilityElement_Class/Reference/Reference.html">UIAccessibilityElement Class reference</a></li>
<li><a href="http://attila.tumblr.com/post/4831332377/on-accessibility-in-ios-development-implementation-in">How TipToe was fixed</a></li>
</ul>
<p><strong>Please note:</strong> Some of the links in this article require an Apple ID or lead to pages that will trigger iTunes.</p>
]]></content:encoded>
			<wfw:commentRss>http://yaccessibilityblog.com/library/ios-accessibilityhint-apps.html/feed</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>Focus Feedback</title>
		<link>http://yaccessibilityblog.com/library/focus-feedback.html</link>
		<comments>http://yaccessibilityblog.com/library/focus-feedback.html#comments</comments>
		<pubDate>Fri, 16 Mar 2012 23:11:05 +0000</pubDate>
		<dc:creator>Todd Kloots</dc:creator>
				<category><![CDATA[Accessible Content]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Keyboard Access]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[keyboard]]></category>

		<guid isPermaLink="false">http://yaccessibilityblog.com/library/?p=1213</guid>
		<description><![CDATA[Visualization of the focus state is vital for keyboard users, but often is missing due to suppression of focus using CSS. Learn more about why focus matters and how to fix it.]]></description>
			<content:encoded><![CDATA[<p>The browser provides visual feedback when a control receives focus. The default visualization usually matches how focus is rendered on the host platform: On Windows this is a subtle dotted outline, on MacOS a blue glow.</p>
<p>Windows: <img src="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/windows-focus.png" alt="" title="Focus outline on Windows" width="76" height="30" class="alignnone size-full wp-image-1224" style="vertical-align:middle" /> Mac: <img src="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/mac-focus.png" alt="" title="Focus outline on MacOS" width="80" height="39" class="alignnone size-full wp-image-1223"  style="vertical-align:middle" />
<p>The focus outline is important in that it both directs the users attention, and serves as a cursor for users who navigate using the keyboard (most commonly by pressing Tab or Shift + Tab). Often the focus outline is removed using CSS, making navigation impossible for keyboard users.</p>
<p><span id="more-1213"></span></p>
<h3>The Problem</h3>
<p>The focus outline is removed when either the <cod>outline-style</code> and/or the <code>outline-width</code> properties are set to "0" or "none", or the <code>outline-color</code> is set to "none" or "transparent." Here's some examples of common uses of the <code>outline</code> found while grepping Yahoo! CSS files.</p>
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;"><span class="kw1">outline</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span><br />
<span class="kw1">outline</span><span class="sy0">:</span> <span class="nu0">0</span><span class="sy0">;</span><br />
<span class="kw1">outline-style</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span><br />
<span class="kw1">outline</span><span class="sy0">:</span> <span class="kw2">medium</span> <span class="kw2">none</span><span class="sy0">;</span><br />
<span class="kw1">outline</span><span class="sy0">:</span> <span class="re3">1px</span><span class="sy0">;</span><br />
<span class="kw1">outline</span><span class="sy0">:</span> <span class="re3">0px</span> <span class="kw2">none</span> <span class="kw2">transparent</span><span class="sy0">;</span></div>
</div>
<h3>The Cause</h3>
<p>That's how outline is being removed, but why? Some common reasons:</p>
<h4>1. Reset stylesheets</h4>
<p>Often outline is set to "none" or "0" by reset stylesheets.</p>
<h4>2. To fix broken or awkward focus outlines</h4>
<p>Sometimes the focus outline is hidden to prevent the user from seeing it rendered broken, often the result of overflow:hidden on one of the container elements. In the following example from Yahoo! News, the clipped focus outline on the Mac makes it difficult to determine which menu item in the drop down actually has focus.</p>
<p><img src="http://yaccessibilityblog.com/library/wp-content/uploads/2012/03/news-menu-2.png" alt="" title="Yahoo! News Menu" width="467" height="371" class="alignnone size-full wp-image-1237" /></p>
<p>The focus outline is also often hidden to prevent the user from seeing an oddly shaped outline resulting from CSS image replacement techniques. For more, see Patrick H. Lauke's article <a href="http://24ways.org/2009/dont-lose-your-focus ">Don't Lose Your :focus.</a>
</p>
<h3>Solutions</h3>
<h4>1. Don't Remove It</h4>
<p>The easiest way to avoid the problem is to not remove the focus outline.</p>
<h4>2. Replace It</h4>
<p>When replacing the outline for a given module or widget, don't use a global selector as this will remove focus for the entire page or application. The more mindful you are of the specificity of the selector(s) used to remove the browser's default focus style, the less likely you are to unintentionally remove the browser's default focus outline from other elements. Here's some examples of common, problematic selectors:</p>
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;"><span class="coMULTI">/* BAD: <br />
&nbsp; &nbsp;Removes the outline from all link elements. */</span><br />
a <span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">outline</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="coMULTI">/* BAD: <br />
&nbsp; &nbsp;Removes the outline when any element receives focus. */</span><br />
<span class="re2">:focus </span><span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">outline</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="coMULTI">/* BAD: <br />
&nbsp; &nbsp;Still too broadly scoped. Perhaps the intention was to <br />
&nbsp; &nbsp;remove the focus outline from the tabs in a tab control,<br />
&nbsp; &nbsp;but would also affect any anchors inside the tab's <br />
&nbsp; &nbsp;content. */</span><br />
<span class="re1">.tabview</span> a <span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">outline</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>When replacing the browser's default focus styles, the goal should be to create rules specific enough to target just the control/element AND state you are looking to address. This will result in code that is less error prone, and more self-documenting.</p>
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;"><span class="coMULTI">/* GOOD:<br />
&nbsp; &nbsp;Targets just focused tabs inside instances of a <br />
&nbsp; &nbsp;tabview control. */</span><br />
<span class="re1">.tabview</span> <span class="re1">.tab</span><span class="re2">:focus </span><span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">outline</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span><br />
&nbsp; <span class="kw1">background-color</span><span class="sy0">:</span> <span class="kw1">blue</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>When replacing the focus outline, consider using one (or more) of the following properties. These work well as they don't affect the box model and cause the surrounding content to reflow when the element receives focus:</p>
<ul>
<li>text-decoration</li>
<li>color</li>
<li>background-color</li>
<li>box-shadow</li>
</ul>
<h3>Limitations in IE</h3>
<p>Custom focus styling is limited in IE depending on the browser version. Prior to 8, IE <em>did</em> provide custom focus styling, but only for links via the <code>:active</code> pseudo class. Further, removing the focus outlined required use of the <a href="http://msdn.microsoft.com/en-us/library/ms533783(v=vs.85).aspx"><code>hidefocus</code></a> attribute or setting the element's <code>tabIndex</code> to -1. For all these reasons, consider custom focus styles a Progressive Enhancement.</p>
<p>Should you need custom focus styling on controls other than links for older versions of IE, you could leverage JavaScript to create a delegated focus and blur event listener that add/removes a class in response to focus and blur. Here's two examples using YUI and jQuery.</p>
<h4>Using YUI</h4>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;"><span class="kw2">var</span> toolbar <span class="sy0">=</span> Y.<span class="me1">one</span><span class="br0">&#40;</span><span class="st0">&quot;#toolbar&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="kw1">if</span> <span class="br0">&#40;</span>Y.<span class="me1">UA</span>.<span class="me1">ie</span> <span class="sy0">&amp;&amp;</span> Y.<span class="me1">UA</span>.<span class="me1">ie</span> <span class="sy0">&lt;</span> <span class="nu0">8</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; toolbar.<span class="me1">delegate</span><span class="br0">&#40;</span><span class="st0">&quot;focus&quot;</span><span class="sy0">,</span> <span class="kw2">function</span> <span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw1">this</span>.<span class="me1">addClass</span><span class="br0">&#40;</span><span class="st0">&quot;focus&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; <span class="br0">&#125;</span><span class="sy0">,</span> <span class="st0">&quot;button&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; toolbar.<span class="me1">delegate</span><span class="br0">&#40;</span><span class="st0">&quot;blur&quot;</span><span class="sy0">,</span> <span class="kw2">function</span> <span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw1">this</span>.<span class="me1">removeClass</span><span class="br0">&#40;</span><span class="st0">&quot;focus&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; <span class="br0">&#125;</span><span class="sy0">,</span> <span class="st0">&quot;button&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<h4>Using jQuery</h4>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;"><span class="kw2">var</span> toolbar <span class="sy0">=</span> $<span class="br0">&#40;</span><span class="st0">&quot;#toolbar&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="kw1">if</span> <span class="br0">&#40;</span>browser.<span class="me1">msie</span> <span class="sy0">&amp;&amp;</span> browser.<span class="me1">version</span> <span class="sy0">&lt;</span> <span class="nu0">8</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; toolbar.<span class="me1">on</span><span class="br0">&#40;</span><span class="st0">&quot;focus&quot;</span><span class="sy0">,</span> <span class="st0">&quot;button&quot;</span><span class="sy0">,</span> <span class="kw2">function</span> <span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">addClass</span><span class="br0">&#40;</span><span class="st0">&quot;focus&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; toolbar.<span class="me1">on</span><span class="br0">&#40;</span><span class="st0">&quot;blur&quot;</span><span class="sy0">,</span> <span class="st0">&quot;button&quot;</span><span class="sy0">,</span> <span class="kw2">function</span> <span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">removeClass</span><span class="br0">&#40;</span><span class="st0">&quot;focus&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<h3>Related Reading and Resources</h3>
<ul>
<li><a href="http://css-tricks.com/removing-the-dotted-outline/">Removing The Dotted Outline by Chris Coyier</a></li>
<li><a href="http://24ways.org/2009/dont-lose-your-focus ">Don't Lose Your :focus by Patrick H. Lauke</a></li>
<li><a href="http://csslint.net/">CSS Lint—Use to guard against use of outline:none</a></li>
<li><a href="https://github.com/stubbornella/csslint/wiki/Disallow-outline%3Anone">Disallow outline:none</a></li>
<li><a href="http://outlinenone.com/">outlinenone.com (That's right, someone registered that domain!)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://yaccessibilityblog.com/library/focus-feedback.html/feed</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>Understanding ARIA Widgets</title>
		<link>http://yaccessibilityblog.com/library/understanding-aria-widgets.html</link>
		<comments>http://yaccessibilityblog.com/library/understanding-aria-widgets.html#comments</comments>
		<pubDate>Tue, 07 Feb 2012 15:39:14 +0000</pubDate>
		<dc:creator>Todd Kloots</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Forms]]></category>
		<category><![CDATA[ARIA]]></category>
		<category><![CDATA[dialog]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[modal]]></category>
		<category><![CDATA[widgets]]></category>

		<guid isPermaLink="false">http://yaccessibilityblog.com/library/?p=1151</guid>
		<description><![CDATA[Make ARIA part of your HTML toolkit. This article explains ARIA  by with existing HTML widgets.]]></description>
			<content:encoded><![CDATA[<p>ARIA is a W3C specification that can be used to dramatically improve the accessibility of custom widgets, especially for users of screen readers. For those unfamiliar with ARIA this article aims to explain the unfamiliar through the lens of the familiar: existing HTML widgets.</p>
<p><span id="more-1151"></span></p>
<p>
The goal is to train developers <em>how to think about ARIA widgets</em> such that using ARIA feels familiar and natural—something all developers can feel confident using and making part of their everyday toolkit.</p>
<p>In the interest of being as concise and straightforward as possible, without being overly pedantic this article will be limited in scope to the markup and styling for ARIA widgets. Keyboard access for ARIA widgets, while an important topic, has been intentionally left out since it is a broader topic deserving an article of its own, and the implementation guidance varies between devices (mobile and desktop) and platforms (Mac and Windows).</p>
<h2 id="roles">Widget Roles</h2>
<p>ARIA provides additional semantics beyond what is available in current implementations of HTML. As the spec indicates, it&#8217;s a bridging technology—filling gaps between versions of the HTML specs. For example, neither HTML 4 or 5 provide a toolbar or dialog widget, but both can be declared using ARIA. Consider the following two examples:</p>
<h3>Toolbar Example</h3>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;tb-1&quot;</span> role<span class="sy0">=</span><span class="st0">&quot;toolbar&quot;</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">button</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;button&quot;</span>&gt;</span>Print<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">button</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">button</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;button&quot;</span>&gt;</span>Move<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">button</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">button</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;button&quot;</span>&gt;</span>Delete<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">button</span>&gt;</span><br />
<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span></div>
</div>
<h3>Dialog Example</h3>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">div</span> role<span class="sy0">=</span><span class="st0">&quot;dialog&quot;</span>&gt;</span>…<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span></div>
</div>
<p>As illustrated in the examples, ARIA widgets are declared by applying the <code>role</code> attribute (<a href="http://www.w3.org/TR/html5/content-models.html#wai-aria">part of HTML5</a>) to existing elements. ARIA roles can be declared in the markup, or applied via JavaScript:</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;"><span class="co1">// Using native DOM</span><br />
document.<span class="me1">getElementById</span><span class="br0">&#40;</span><span class="st0">&quot;tb-1&quot;</span><span class="br0">&#41;</span>.<span class="me1">setAttribute</span><span class="br0">&#40;</span><span class="st0">&quot;role&quot;</span><span class="sy0">,</span> <span class="st0">&quot;toolbar&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p><span class="co1">// Using jQuery</span><br />
$<span class="br0">&#40;</span><span class="st0">&quot;#tb-1&quot;</span><span class="br0">&#41;</span>.<span class="me1">attr</span><span class="br0">&#40;</span><span class="st0">&quot;role&quot;</span><span class="sy0">,</span> <span class="st0">&quot;toolbar&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p><span class="co1">// Using YUI</span><br />
Y.<span class="me1">one</span><span class="br0">&#40;</span><span class="st0">&quot;#tb-1&quot;</span><span class="br0">&#41;</span>.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">&quot;role&quot;</span><span class="sy0">,</span> <span class="st0">&quot;toolbar&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
<p>Like the <code>&#60;input&#62;</code> element&#8217;s <code>type</code> attribute, the ARIA <code>role</code> attribute can only be set to <a href="#widget-reference">one of several predefined values</a>. In the interest of <a href="http://en.wikipedia.org/wiki/Progressive_enhancement">Progressive Enhancement</a>, when building custom widgets always start with the closest native semantics and supplement with ARIA. Consider this tree widget that uses a <code>&#60;ul&#62;</code> as its foundation:</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">ul</span> role<span class="sy0">=</span><span class="st0">&quot;tree&quot;</span> <span class="kw3">tabindex</span><span class="sy0">=</span><span class="st0">&quot;0&quot;</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">li</span> role<span class="sy0">=</span><span class="st0">&quot;treeitem&quot;</span> <span class="kw3">tabindex</span><span class="sy0">=</span><span class="st0">&quot;-1&quot;</span>&gt;</span>Item 1<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">li</span> role<span class="sy0">=</span><span class="st0">&quot;presentation&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">a</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#group-1&quot;</span> role<span class="sy0">=</span><span class="st0">&quot;treeitem&quot;</span> aria-expanded<span class="sy0">=</span><span class="st0">&quot;true&quot;</span> <span class="kw3">tabindex</span><span class="sy0">=</span><span class="st0">&quot;-1&quot;</span>&gt;</span>Item 2<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">ul</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;group-1&quot;</span> role<span class="sy0">=</span><span class="st0">&quot;group&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">li</span> role<span class="sy0">=</span><span class="st0">&quot;treeitem&quot;</span> <span class="kw3">tabindex</span><span class="sy0">=</span><span class="st0">&quot;-1&quot;</span>&gt;</span>Item 2-1<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">li</span> role<span class="sy0">=</span><span class="st0">&quot;treeitem&quot;</span> <span class="kw3">tabindex</span><span class="sy0">=</span><span class="st0">&quot;-1&quot;</span>&gt;</span>Item 2-2<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">li</span> role<span class="sy0">=</span><span class="st0">&quot;treeitem&quot;</span> <span class="kw3">tabindex</span><span class="sy0">=</span><span class="st0">&quot;-1&quot;</span>&gt;</span>Item 2-3<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">ul</span>&gt;</span> &nbsp; <br />
&nbsp; <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span> &nbsp; &nbsp;<br />
<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">ul</span>&gt;</span></div>
</div>
<h2 id="properties">Widget Properties</h2>
<p>Like existing HTML widgets, ARIA widgets have properties used to configure their behavior. For example, a <code>&#60;textarea&#62;</code> can be declared read only by adding the <code>readonly</code> attribute. ARIA properties work exactly the same way, but they require an &#8220;aria-&#8221; prefix.<br />
For example, the previous tree widget can be configured to support multiple selection using the <code>aria-multiselectable</code> attribute.</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">ul</span> role<span class="sy0">=</span><span class="st0">&quot;tree&quot;</span> aria-multiselectable<span class="sy0">=</span><span class="st0">&quot;true&quot;</span> <span class="kw3">tabindex</span><span class="sy0">=</span><span class="st0">&quot;0&quot;</span>&gt;</span>…<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">ul</span>&gt;</span></div>
</div>
<p>ARIA properties can also be used with existing HTML widgets. For example, to declare a button with a popup menu add the <code>aria-haspopup</code> attribute.</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">button</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;btn-1&quot;</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;button&quot;</span> aria-haspopup<span class="sy0">=</span><span class="st0">&quot;true&quot;</span>&gt;</span>Show Options<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">button</span>&gt;</span></div>
</div>
<p>Properties can also be set using JavaScript:</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;"><span class="co1">// Using native DOM</span><br />
document.<span class="me1">getElementById</span><span class="br0">&#40;</span><span class="st0">&quot;btn-1&quot;</span><span class="br0">&#41;</span>.<span class="me1">setAttribute</span><span class="br0">&#40;</span><span class="st0">&quot;aria-haspopup&quot;</span><span class="sy0">,</span> <span class="kw2">true</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p><span class="co1">// Using jQuery</span><br />
$<span class="br0">&#40;</span><span class="st0">&quot;#tb-1&quot;</span><span class="br0">&#41;</span>.<span class="me1">attr</span><span class="br0">&#40;</span><span class="st0">&quot;aria-haspopup&quot;</span><span class="sy0">,</span> <span class="kw2">true</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p><span class="co1">// Using the set() method of YUI3</span><br />
Y.<span class="me1">one</span><span class="br0">&#40;</span><span class="st0">&quot;#tb-1&quot;</span><span class="br0">&#41;</span>.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">&quot;aria-haspopup&quot;</span><span class="sy0">,</span> <span class="kw2">true</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
<p>The complete set of properties for each ARIA widget are listed alongside each widget role in the <a href="http://www.w3.org/TR/wai-aria/">ARIA Specification</a>. Click any of the widget roles in the <a href="#widget-reference">Widget Role Reference</a> section to reveal the widget&#8217;s corresponding properties in the ARIA Spec.</p>
<h2 id="states">Widget States</h2>
<p>In addition to properties, ARIA widgets have attributes used to represent states—and they work just like state attributes found in existing HTML widgets. For example, the checked state of an HTML checkbox is represented via the <code>checked</code> attribute:</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;checkbox&quot;</span> checked&gt;</span></div>
</div>
<p>ARIA states work exactly the same way, and like the ARIA properties, they require an &#8220;aria-&#8221; prefix. Returning to the tree widget example, tree items can be expanded and collapsed, and that state is represented using the <code>aria-expanded</code> attribute.</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">a</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#group-1&quot;</span> role<span class="sy0">=</span><span class="st0">&quot;treeitem&quot;</span> aria-expanded<span class="sy0">=</span><span class="st0">&quot;true&quot;</span> <span class="kw3">tabindex</span><span class="sy0">=</span><span class="st0">&quot;-1&quot;</span>&gt;</span>Item 2<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">ul</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;group-1&quot;</span> role<span class="sy0">=</span><span class="st0">&quot;group&quot;</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">li</span> role<span class="sy0">=</span><span class="st0">&quot;treeitem&quot;</span> <span class="kw3">tabindex</span><span class="sy0">=</span><span class="st0">&quot;-1&quot;</span>&gt;</span>Item 2-1<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">li</span> role<span class="sy0">=</span><span class="st0">&quot;treeitem&quot;</span> <span class="kw3">tabindex</span><span class="sy0">=</span><span class="st0">&quot;-1&quot;</span>&gt;</span>Item 2-2<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">li</span> role<span class="sy0">=</span><span class="st0">&quot;treeitem&quot;</span> <span class="kw3">tabindex</span><span class="sy0">=</span><span class="st0">&quot;-1&quot;</span>&gt;</span>Item 2-3<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">ul</span>&gt;</span></div>
</div>
<p>And like ARIA properties, ARIA states can also be used with existing HTML widgets. For example, add the <code>aria-invalid</code> attribute to indicate the user has entered an invalid value into a text field.</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text&quot;</span> aria-invalid<span class="sy0">=</span><span class="st0">&quot;true&quot;</span>&gt;</span></div>
</div>
<p>All of the states for each ARIA widget are listed alongside each widget role in the <a href="http://www.w3.org/TR/wai-aria/">ARIA Specification</a>. Click any of the widget roles in the <a href="#widget-reference">Widget Role Reference</a> section to reveal its corresponding states in the ARIA Spec.</p>
<h3 id="managing-states">Managing States and Properites</h3>
<p>The behavior associated with the states and properties of existing HTML widgets are implemented by the browser. For example, the value of the <code>checked</code> attribute is changed automatically when the user checks or unchecks a checkbox.
</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;checkbox-1&quot;</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;checkbox&quot;</span> checked&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">script</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span>&gt;</span></p>
<p>document.getElementById(&quot;checkbox-1&quot;).onclick = function (e) {<br />
&nbsp; console.log(e.target.checked);<br />
};</p>
<p><span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">script</span>&gt;</span></div>
</div>
<p><em>Unlike</em> existing HTML widgets, the behaviors associated with ARIA widget states and properties <strong>are not managed by the browser</strong>.  As such, it&#8217;s necessary to implement the expected behaviors using JavaScript. To revisit the tree widget example, the initial <code>aria-expanded</code> state of a leaf node might be declared in the markup, but will be toggled in response to click events.</p>
<h3>Initial State Declared in Markup</h3>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">a</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;treeitem-1&quot;</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#group-1&quot;</span> role<span class="sy0">=</span><span class="st0">&quot;treeitem&quot;</span> aria-expanded<span class="sy0">=</span><span class="st0">&quot;false&quot;</span>&gt;</span>Item 2<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;</span></div>
</div>
<h3>State Changes Managed Using JavaScript:</h3>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;"><span class="kw2">function</span> onItemClick<span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; e.<span class="me1">preventDefault</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; <span class="kw2">var</span> target <span class="sy0">=</span> e.<span class="me1">target</span><span class="sy0">;</span><br />
&nbsp; target.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">&quot;aria-expanded&quot;</span><span class="sy0">,</span> <span class="sy0">!</span><span class="br0">&#40;</span>target.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">&quot;aria-expanded&quot;</span><span class="br0">&#41;</span> <span class="sy0">===</span> <span class="st0">&quot;true&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span><br />
document.<span class="me1">getElementById</span><span class="br0">&#40;</span><span class="st0">&quot;treeitem-1&quot;</span><span class="br0">&#41;</span>.<span class="me1">onclick</span> <span class="sy0">=</span> onItemClick<span class="sy0">;</span></div>
</div>
<h2 id="labels">Widget Labels</h2>
<p>The <code>&#60;label&#62;</code> element has been the tried and true method for labeling existing HTML widgets. ARIA provides several new methods of labeling widgets.</p>
<h3><a href="http://www.w3.org/TR/wai-aria/complete#aria-label"><code>aria-label</code> attribute</a></h3>
<p>Specifies the text label inline, but isn&#8217;t visually rendered. Handy when there&#8217;s no space for a label on screen and the <code>title</code> attribute is already used to supply an instructional tooltip for sighted users. For example a checkbox in a table cell:</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;checkbox&quot;</span> aria-<span class="kw3">label</span><span class="sy0">=</span><span class="st0">&quot;Message 1&quot;</span> <span class="kw3">title</span><span class="sy0">=</span><span class="st0">&quot;Click to select this message&quot;</span>&gt;</span></div>
</div>
<h3><a href="http://www.w3.org/TR/wai-aria/complete#aria-labelleby"><code>aria-labelledby</code> attribute</a></h3>
<p>Specifies the id(s) of the element(s) whose text content labels the control.  Useful when the desired label text is already present in another element in the DOM. Remember, if the design doesn&#8217;t require the text label be visible, <a href="http://snook.ca/archives/html_and_css/hiding-content-for-accessibility">hide it in an accessible way using CSS</a>.</p>
<p>Some example uses of <code>aria-labelledby</code>:</p>
<h4>Labeling an alert dialog widget:</h4>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">div</span> role<span class="sy0">=</span><span class="st0">&quot;alertdialog&quot;</span> aria-labelledby<span class="sy0">=</span><span class="st0">&quot;hd&quot;</span> aria-describedby<span class="sy0">=</span><span class="st0">&quot;msg&quot;</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">form</span>&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">fieldset</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">legend</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;hd&quot;</span>&gt;</span>Confirm Action<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">legend</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">p</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;msg&quot;</span>&gt;</span>Are you sure you want to submit this form?<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">p</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;button&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;ok-button&quot;</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;OK&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;button&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;cancel-button&quot;</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;Cancel&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">fieldset</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">form</span>&gt;</span><br />
<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span></div>
</div>
<h4>Labeling a listbox widget:</h4>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">h2</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;hd&quot;</span>&gt;</span>Folders<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">h2</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">ul</span> role<span class="sy0">=</span><span class="st0">&quot;listbox&quot;</span> aria-labelledby<span class="sy0">=</span><span class="st0">&quot;hd&quot;</span> <span class="kw3">tabindex</span><span class="sy0">=</span><span class="st0">&quot;0&quot;</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">li</span> role<span class="sy0">=</span><span class="st0">&quot;option&quot;</span> <span class="kw3">tabindex</span><span class="sy0">=</span><span class="st0">&quot;-1&quot;</span>&gt;</span>Inbox<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">li</span> role<span class="sy0">=</span><span class="st0">&quot;option&quot;</span> <span class="kw3">tabindex</span><span class="sy0">=</span><span class="st0">&quot;-1&quot;</span>&gt;</span>Drafts<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">li</span> role<span class="sy0">=</span><span class="st0">&quot;option&quot;</span> <span class="kw3">tabindex</span><span class="sy0">=</span><span class="st0">&quot;-1&quot;</span>&gt;</span>Sent<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span> <br />
&nbsp; <span class="sc2">&lt;<span class="kw2">li</span> role<span class="sy0">=</span><span class="st0">&quot;option&quot;</span> <span class="kw3">tabindex</span><span class="sy0">=</span><span class="st0">&quot;-1&quot;</span>&gt;</span>Spam<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span> <br />
&nbsp; <span class="sc2">&lt;<span class="kw2">li</span> role<span class="sy0">=</span><span class="st0">&quot;option&quot;</span> <span class="kw3">tabindex</span><span class="sy0">=</span><span class="st0">&quot;-1&quot;</span>&gt;</span>Trash<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span><br />
<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">ul</span>&gt;</span></div>
</div>
<h3><a href="http://www.w3.org/TR/wai-aria/complete#aria-describedby"><code>aria-describedby</code> attribute</a></h3>
<p>Specifies the id(s) of the element(s) whose text provides a description supplemental to the label.  For example: an error message associated with a form field that has invalid user input.</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">&quot;first-name&quot;</span>&gt;</span>First<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">label</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text&quot;</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;first-name&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;first-name&quot;</span> required aria-required<span class="sy0">=</span><span class="st0">&quot;true&quot;</span> aria-invalid<span class="sy0">=</span><span class="st0">&quot;true&quot;</span> aria-describedby<span class="sy0">=</span><span class="st0">&quot;err-msg&quot;</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">p</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;err-msg&quot;</span>&gt;</span>Cannot be blank.<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">p</span>&gt;</span></div>
</div>
<h2 id="styling">Widget Styling</h2>
<p>Unlike existing HTML widgets, ARIA widgets don&#8217;t provide any default presentation. However, most modern browsers support <a href="http://www.w3.org/TR/selectors/#attribute-selectors">CSS Attribute Selectors</a>, making it easy to style the various ARIA widget types by targeting the <code>role</code> attribute.</p>
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;">ul<span class="br0">&#91;</span>role<span class="sy0">=</span>tree<span class="br0">&#93;</span> <span class="br0">&#123;</span><br />
<span class="br0">&#125;</span><br />
div<span class="br0">&#91;</span>role<span class="sy0">=</span>dialog<span class="br0">&#93;</span> <span class="br0">&#123;</span><br />
<span class="br0">&#125;</span></div>
</div>
<h3 id="styling-state">Styling States and Properties</h3>
<p>
Like behaviors, the style for states and properties of existing HTML widgets is automatically managed by the browser. For example, when the user checks a checkbox, a checkmark is added or removed. Disabled controls are automatically rendered grayed out when the <code>disabled</code> attribute is removed.</p>
<p>As mentioned earlier, ARIA widgets states and properties are <strong>unmanaged</strong>; developers are responsible for defining the visual style associated with widget states and properties. In most modern browsers this can be accomplished using CSS Attribute Selectors. For example, to style a button that has a popup menu:</p>
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;">button<span class="br0">&#91;</span>aria-haspopup<span class="br0">&#93;</span> <span class="br0">&#123;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>Returning to the tree view widget, style the expanded or collapsed states:</p>
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;">a<span class="br0">&#91;</span>aria-<span class="kw2">expanded</span><span class="sy0">=</span>true<span class="br0">&#93;</span> <span class="sy0">+</span> ul<span class="br0">&#91;</span>role<span class="sy0">=</span>group<span class="br0">&#93;</span> <span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">block</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span><br />
a<span class="br0">&#91;</span>aria-<span class="kw2">expanded</span><span class="sy0">=</span>false<span class="br0">&#93;</span> <span class="sy0">+</span> ul<span class="br0">&#91;</span>role<span class="sy0">=</span>group<span class="br0">&#93;</span> <span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<h2 id="widget-reference">Widget Role Reference</h2>
<p>
The ARIA <code>role</code> attribute can only be set to one of the following predefined values. In the interest of helping developers find the right widget role for the job, the roles have been organized into three categories. Each of the following widget roles is linked to the ARIA Spec, which details the properties and states associated with each role.</p>
<h3 id="widgets">Individual Atomic Widgets</h3>
<ul>
<li><a href="http://www.w3.org/TR/wai-aria/complete#spinbutton">spinbutton</a></li>
<li><a href="http://www.w3.org/TR/wai-aria/complete#slider">slider</a></li>
<li><a href="http://www.w3.org/TR/wai-aria/complete#progressbar">progressbar</a></li>
<li><a href="http://www.w3.org/TR/wai-aria/complete#button">button</a></li>
<li><a href="http://www.w3.org/TR/wai-aria/complete#radio">radio</a></li>
<li><a href="http://www.w3.org/TR/wai-aria/complete#textbox">textbox</a></li>
<li><a href="http://www.w3.org/TR/wai-aria/complete#toolbar">checkbox</a></li>
</ul>
<h3 id="overlay-widgets">Overlay Widgets</h3>
<ul>
<li><a href="http://www.w3.org/TR/wai-aria/complete#dialog">dialog</a></li>
<li><a href="http://www.w3.org/TR/wai-aria/complete#alertdialog">alertdialog</a></li>
<li><a href="http://www.w3.org/TR/wai-aria/complete#tooltip">tooltip</a></li>
<li>
        <a href="http://www.w3.org/TR/wai-aria/complete#menu">menu</a></p>
<ul>
<li><a href="http://www.w3.org/TR/wai-aria/complete#menuitem">menuitem</a></li>
<li><a href="http://www.w3.org/TR/wai-aria/complete#menuitemcheckbox">menuitemcheckbox</a></li>
<li><a href="http://www.w3.org/TR/wai-aria/complete#menuitemradio">menuitemradio</a></li>
</ul>
</li>
</ul>
<h3 id="composite-widgets">Composite Widgets / Managed Containers</h3>
<ul>
<li><a href="http://www.w3.org/TR/wai-aria/complete#combobox">combobox</a></li>
<li>
        <a href="http://www.w3.org/TR/wai-aria/complete#grid">grid</a></p>
<ul>
<li><a href="http://www.w3.org/TR/wai-aria/complete#row">row</a></li>
<li><a href="http://www.w3.org/TR/wai-aria/complete#rowgroup">rowgroup</a></li>
<li><a href="http://www.w3.org/TR/wai-aria/complete#columnheader">columnheader</a></li>
<li><a href="http://www.w3.org/TR/wai-aria/complete#gridcell">gridcell</a></li>
<li><a href="http://www.w3.org/TR/wai-aria/complete#rowheader">rowheader</a></li>
</ul>
</li>
<li>
        <a href="http://www.w3.org/TR/wai-aria/complete#listbox">listbox</a></p>
<ul>
<li><a href="http://www.w3.org/TR/wai-aria/complete#option">option</a></li>
</ul>
</li>
<li><a href="http://www.w3.org/TR/wai-aria/complete#menubar">menubar</a></li>
<li>
        <a href="http://www.w3.org/TR/wai-aria/complete#radiogroup">radiogroup</a></p>
<ul>
<li><a href="http://www.w3.org/TR/wai-aria/complete#radio">radio</a></li>
</ul>
</li>
<li>
        <a href="http://www.w3.org/TR/wai-aria/complete#tablist">tablist</a></p>
<ul>
<li><a href="http://www.w3.org/TR/wai-aria/complete#tab">tab</a></li>
<li><a href="http://www.w3.org/TR/wai-aria/complete#tabpanel">tabpanel</a></li>
</ul>
</li>
<li>
        <a href="http://www.w3.org/TR/wai-aria/complete#tree">tree</a> &#038; <a href="http://www.w3.org/TR/wai-aria/complete#treegrid">treegrid</a></a></p>
<ul>
<li><a href="http://www.w3.org/TR/wai-aria/complete#treeitem">treeitem</a></li>
<li><a href="http://www.w3.org/TR/wai-aria/complete#group">group</a></li>
</ul>
</li>
<li><a href="http://www.w3.org/TR/wai-aria/complete#toolbar">toolbar</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://yaccessibilityblog.com/library/understanding-aria-widgets.html/feed</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>Open-Captions, Using Closed Captions as Meta Data for ASL</title>
		<link>http://yaccessibilityblog.com/library/open-captions-meta-data-asl.html</link>
		<comments>http://yaccessibilityblog.com/library/open-captions-meta-data-asl.html#comments</comments>
		<pubDate>Mon, 24 Oct 2011 19:54:27 +0000</pubDate>
		<dc:creator>Ted Drake</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[ASL]]></category>
		<category><![CDATA[captions]]></category>
		<category><![CDATA[closed captions]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[YouTube]]></category>

		<guid isPermaLink="false">http://yaccessibilityblog.com/library/?p=1063</guid>
		<description><![CDATA[Guest contributor Narayanan Ramakrishnan discusses his project Open-Captions and how it parses the closed caption of a YouTube video to provide ASL translations.]]></description>
			<content:encoded><![CDATA[<p>This post is by guest author <a href="http://www.naduism.com/"><img src="http://yaccessibilityblog.com/library/wp-content/uploads/2011/10/nadu.jpg" alt=""  width="128" height="128" class="alignright size-full wp-image-1076" />Narayanan Ramakrishnan</a>, whose Open-Captions project parses the closed caption track of a YouTube video to provide ASL translations of words. Caption tracks include timestamps and text, parsing this as meta data opens new opportunities for contextually dynamic pages. </p>
<p>Narayanan is a <a href="http://www.gatech.edu/">GeorgiaTech</a> graduate and has a passion for creating accessible tech projects.  Previous projects include an accessible map of New York City, transliteration of Facebook posts, and visual guide to Indian politics.</p>
<hr style="clear:right"/>
<h3> What is Open-Captions?</h3>
<p>According<a href="http://open-captions.com"></a> to <a href="http://onlinelibrary.wiley.com/doi/10.1111/j.1469-7610.1997.tb01597.x/abstract">research</a>, over 90% of deaf children have hearing parents who &#8220;frequently do not have fully effective means of communicating with them&#8221;. The <a href="http://en.wikipedia.org/wiki/American_sign_language" title="American Sign Language">American Sign Language</a> (ASL) is a difficult language to learn, especially as a second language. </p>
<p><a href="http://open-captions.com" title="Open-Captions">Open-Captions</a> makes it easy for parents and children to learn  and practice American Sign Language together while watching their favorite videos on YouTube. People can find closed captioned videos on any topic with the <a href="http://open-captions.com" title="Open-Captions">Open-Captions</a> search engine. The viewer is able to select individual words in the video&#8217;s caption stream and see the American Sign Language representation of the word.</p>
<p><span id="more-1063"></span></p>
<p><a href="http://www.naduism.com/blog/wp-content/uploads/2011/10/open-captions1.png" rel="lightbox[134]"><img src="http://www.naduism.com/blog/wp-content/uploads/2011/10/open-captions1-e1319393662874.png" alt="Open Captions Example Screenshot" title="open-captions1" width="590" height="290" class="aligncenter size-full wp-image-135" /></a></p>
<p>Closed captions on various television shows have been around for quite some time. They are useful for hearing impaired people and also to people whose first language is not English.<br />
Captions have always been a steady stream of white text on black background, located either at the top or bottom of the screen. Video sites like <a href="http://youtube.com" title="YouTube">YouTube</a> and <a href="http://hulu.com" title="Hulu">Hulu </a>, have adopted the same style from television.<br />
<a href="http://open-captions.com" title="Open-Captions">Open-Captions</a>, changes the way users watch videos by making the captions more interactive. </p>
<ul>
<li>The viewer can pause the video, select a word and watch an ASL representation.</li>
<li>The viewer can review earlier captions with the &#8220;Previous Caption&#8221; button.</li>
</ul>
<p>The American Sign Language representations are shown from the <a href="http://cats.gatech.edu/mysignlink" title="SmartSign Dictionary">SmartSign </a>dictionary maintained by Georgia Institute of Technology&#8217;s Center for Accessible Technology in Sign (<a href="http://cats.gatech.edu/">CATS</a>). </p>
<h4 class='graybackground'>How did Open-Captions come about?</h4>
<p>My interest in building Assistive Technologies has been one of the main motivating forces behind getting a graduate degree in Computer Science. </p>
<p>I built a web based widget platform for Interactive TV as a graduate student researcher at GeorgiaTech. In the process I worked on developing functionality that would allow widget developers to access the closed captions associated with the currently playing content.<br />
<a href="http://cats.gatech.edu/content/harley-hamilton" title="Harley Hamilton">Harley Hamilton</a>, a researcher at CATS, was interested in leveraging this ability of accessing closed captions and we ended up building a <a href="http://vimeo.com/22262335" title="Chimpoo">rough prototype</a>. Subsequently, I learnt more about hearing impaired children from Harley and wrote a <a href="http://www.naduism.com/2011/04/15/asl-greasemonkey-script/" title="Greasemonkey Script for ASL">small tool</a> using which one can select any word on a webpage and see the American Sign Language representation of the word. This would be very useful for parents who want to learn ASL.</p>
<p>In September this year, I signed up for the <a href="http://hackday.tv/" title="HackdayTV">HackdayTV </a> weekend hackathon and ended up building the first version of Open-Captions, which is the mashup of the earlier ideas I had worked on related to ASL.</p>
<h4 class='graybackground'>What happens behind the scenes in Open-Captions?</h4>
<p><strong> Disclaimer: Technical content ahead  <img src='http://yaccessibilityblog.com/library/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />   </strong><br />
The entire source code for the project can be found on <a href="https://github.com/nadu/open-captions" title="GitHub Source">GitHub</a></p>
<p>YouTube has extensive documentation on how to use their APIs for search, embedding and controlling videos on your site. The search and results page are based on the PHP library of the YouTube search API. The page on which the video plays is the one that gets interesting. There are 2 parts to it -</p>
<ul>
<li>Getting the closed captions of the video and synchronizing it to show correctly</li>
<li> Handling the mouse clicks on the individual words to show the ASL representation</li>
</ul>
<p>I used <a href="http://getfirebug.com" title="Firebug">Firebug </a>to see what requests YouTube sends whenever you click on the &#8220;Interactive Transcript&#8221; icon under the video. I removed parameters that were not mandatory (i.e. I would still get the same result if I removed them) and made a PHP curl request for the trimmed URL to get the captions formatted as XML. For this <a href="http://www.youtube.com/watch?v=UZHSDjtD-dg" title="Sesame Street Video">YouTube video</a> the URL for the captions would be </p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;">http://www.youtube.com/api/timedtext?lang=en<span class="sc1">&amp;format=1&amp;v={VIDEO_ID}&amp;type=track&amp;kind=&amp;hl=en</span></div>
</div>
<p>and the result will be of the form </p>
<div class="codesnip-container" >
<div class="xml codesnip" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;transcript<span class="re2">&gt;</span></span></span><br />
<span class="sc3"><span class="re1">&lt;text</span> <span class="re0">start</span>=<span class="st0">&quot;0.734&quot;</span> <span class="re0">dur</span>=<span class="st0">&quot;4.299&quot;</span><span class="re2">&gt;</span></span>[Sesame Street theme music]<span class="sc3"><span class="re1">&lt;/text<span class="re2">&gt;</span></span></span><br />
<span class="sc3"><span class="re1">&lt;text</span> <span class="re0">start</span>=<span class="st0">&quot;5.033&quot;</span> <span class="re0">dur</span>=<span class="st0">&quot;1&quot;</span><span class="re2">&gt;</span></span>Elmo: You okay, Chris?<span class="sc3"><span class="re1">&lt;/text<span class="re2">&gt;</span></span></span><br />
<span class="sc3"><span class="re1">&lt;text</span> <span class="re0">start</span>=<span class="st0">&quot;6.033&quot;</span> <span class="re0">dur</span>=<span class="st0">&quot;1&quot;</span><span class="re2">&gt;</span></span>Chris: I&#8217;m good, I&#8217;m good.<span class="sc3"><span class="re1">&lt;/text<span class="re2">&gt;</span></span></span><br />
<span class="sc3"><span class="re1">&lt;text</span> <span class="re0">start</span>=<span class="st0">&quot;7.033&quot;</span> <span class="re0">dur</span>=<span class="st0">&quot;1&quot;</span><span class="re2">&gt;</span></span>Elmo: You ready?<span class="sc3"><span class="re1">&lt;/text<span class="re2">&gt;</span></span></span><br />
<span class="sc3"><span class="re1">&lt;text</span> <span class="re0">start</span>=<span class="st0">&quot;8.033&quot;</span> <span class="re0">dur</span>=<span class="st0">&quot;1.067&quot;</span><span class="re2">&gt;</span></span>Chris: Yeah, I&#8217;m ready. Oh, hey!<span class="sc3"><span class="re1">&lt;/text<span class="re2">&gt;</span></span></span><br />
<span class="sc3"><span class="re1">&lt;text</span> <span class="re0">start</span>=<span class="st0">&quot;9.1&quot;</span> <span class="re0">dur</span>=<span class="st0">&quot;1.467&quot;</span><span class="re2">&gt;</span></span>Red light&#8217;s on. Hey, hi, everybody.<span class="sc3"><span class="re1">&lt;/text<span class="re2">&gt;</span></span></span><br />
<span class="sc3"><span class="re1">&lt;text</span> <span class="re0">start</span>=<span class="st0">&quot;10.567&quot;</span> <span class="re0">dur</span>=<span class="st0">&quot;1.034&quot;</span><span class="re2">&gt;</span></span>I&#8217;m Chris.<span class="sc3"><span class="re1">&lt;/text<span class="re2">&gt;</span></span></span><br />
<span class="sc3"><span class="re1">&lt;text</span> <span class="re0">start</span>=<span class="st0">&quot;11.601&quot;</span> <span class="re0">dur</span>=<span class="st0">&quot;1&quot;</span><span class="re2">&gt;</span></span>Elmo: Oh, and Elmo&#8217;s Elmo.<span class="sc3"><span class="re1">&lt;/text<span class="re2">&gt;</span></span></span><br />
<span class="sc3"><span class="re1">&lt;text</span> <span class="re0">start</span>=<span class="st0">&quot;12.601&quot;</span> <span class="re0">dur</span>=<span class="st0">&quot;1.367&quot;</span><span class="re2">&gt;</span></span>Chris: Mm-hmm, he sure is.<span class="sc3"><span class="re1">&lt;/text<span class="re2">&gt;</span></span></span><br />
<span class="sc3"><span class="re1">&lt;text</span> <span class="re0">start</span>=<span class="st0">&quot;13.968&quot;</span> <span class="re0">dur</span>=<span class="st0">&quot;3.199&quot;</span><span class="re2">&gt;</span></span>I work at Hooper&#8217;s Store right here on Sesame Street.<span class="sc3"><span class="re1">&lt;/text<span class="re2">&gt;</span></span></span><br />
<span class="sc3"><span class="re1">&lt;/transcript<span class="re2">&gt;</span></span></span></div>
</div>
<p>As far as I understood, not all YouTube videos with captions could be accessed with the above API call because their caption files had names. Then, I came across this <a href="http://userscripts.org/scripts/show/50003" title="User Script">user script</a> which is useful if you want to download the captions file. The author had a snippet of code for retrieving the name of the captions file &#8211; </p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;">http://video.google.com/timedtext?hl=en<span class="sc1">&amp;v={VIDEO_ID}&amp;type=list</span></div>
</div>
<p>this returned an XML with the name of the captions file. I used that to extend my API call to </p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;">http://www.youtube.com/api/timedtext?lang=en<span class="sc1">&amp;format=1&amp;v={VIDEO_ID}&amp;type=track&amp;kind=&amp;hl=en&amp;name={CAPTION_FILE_NAME}</span></div>
</div>
<p>Then using JavaScript setTimeout function and the values of the start and duration of the captions, I do the synchronization of the captions and the video. </p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;"><span class="kw2">function</span> showAppropriateCaptions<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp;<span class="kw2">var</span> i<span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp;len <span class="sy0">=</span> global_full_captions.<span class="me1">length</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp;currTime<span class="sy0">;</span><br />
&nbsp; &nbsp;<span class="co1">//my_ytPlayer is the handle of the YouTube player</span><br />
&nbsp; &nbsp;<span class="kw1">if</span><span class="br0">&#40;</span>my_ytPlayer.<span class="me1">getPlayerState</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">==</span> <span class="sy0">-</span>1<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">return</span><span class="sy0">;</span><br />
&nbsp; &nbsp;<span class="br0">&#125;</span><br />
&nbsp; &nbsp;<span class="kw1">if</span><span class="br0">&#40;</span>my_ytPlayer.<span class="me1">getPlayerState</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">==</span> <span class="nu0">1</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span class="co1">// State = 1 =&gt; playing video &#8211; so get the time and show appropriate captions</span><br />
&nbsp; &nbsp; &nbsp; <span class="co1">// this will get triggered automatically when the video starts for the very first time</span><br />
&nbsp; &nbsp; &nbsp; currTime <span class="sy0">=</span> my_ytPlayer.<span class="me1">getCurrentTime</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp;<span class="co1">// to-do: a better way to handle hide show instead of doing at every iteration</span><br />
&nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&#8216;.myCaptionSpan&#8217;</span><span class="br0">&#41;</span>.<span class="me1">show</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><span class="co1">// the container having the captions</span><br />
&nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&#8216;#previous&#8217;</span><span class="br0">&#41;</span>.<span class="me1">show</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// the previous button </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span><span class="br0">&#40;</span>i<span class="sy0">=</span><span class="nu0">0</span><span class="sy0">;</span>i<span class="sy0">&lt;</span>len<span class="sy0">;</span>i<span class="sy0">++</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span>currTime <span class="sy0">&lt;</span> global_full_captions<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span>.<span class="me1">startTime</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// if the captions has not started, call just before the first caption is scheduled</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setTimeout<span class="br0">&#40;</span>showAppropriateCaptions<span class="sy0">,</span> <span class="br0">&#40;</span>global_full_captions<span class="br0">&#91;</span>0<span class="br0">&#93;</span>.<span class="me1">startTime</span> <span class="sy0">-</span> currTime <span class="br0">&#41;</span><span class="sy0">*</span>1000<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span>currTime <span class="sy0">&gt;</span> global_full_captions<span class="br0">&#91;</span>len<span class="sy0">-</span><span class="nu0">1</span><span class="br0">&#93;</span>.<span class="me1">startTime</span> <span class="sy0">+</span> global_full_captions<span class="br0">&#91;</span>len<span class="sy0">-</span><span class="nu0">1</span><span class="br0">&#93;</span>.<span class="me1">duration</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// it has ended, no more captions to show</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&#8216;.myCaptionSpan&#8217;</span><span class="br0">&#41;</span>.<span class="me1">hide</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&quot;#previous&quot;</span><span class="br0">&#41;</span>.<span class="me1">removeClass</span><span class="br0">&#40;</span><span class="st0">&#8216;enabled&#8217;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&quot;#previous&quot;</span><span class="br0">&#41;</span>.<span class="me1">attr</span><span class="br0">&#40;</span><span class="st0">&quot;disabled&quot;</span><span class="sy0">,</span><span class="kw2">true</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><span class="br0">&#40;</span>global_full_captions<span class="br0">&#91;</span>len<span class="sy0">-</span><span class="nu0">1</span><span class="br0">&#93;</span>.<span class="me1">startTime</span> <span class="sy0">&lt;=</span> currTime <span class="sy0">&amp;&amp;</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>global_full_captions<span class="br0">&#91;</span>len<span class="sy0">-</span><span class="nu0">1</span><span class="br0">&#93;</span>.<span class="me1">startTime</span> <span class="sy0">+</span> global_full_captions<span class="br0">&#91;</span>i<span class="br0">&#93;</span>.<span class="me1">duration</span><span class="br0">&#41;</span> <span class="sy0">&gt;</span> currTime<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// ugly workaround for showing the last caption</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><span class="sy0">!</span>$<span class="br0">&#40;</span><span class="st0">&#8216;#previous&#8217;</span><span class="br0">&#41;</span>.<span class="me1">hasClass</span><span class="br0">&#40;</span><span class="st0">&#8216;enabled&#8217;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&quot;#previous&quot;</span><span class="br0">&#41;</span>.<span class="me1">addClass</span><span class="br0">&#40;</span><span class="st0">&#8216;enabled&#8217;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&quot;#previous&quot;</span><span class="br0">&#41;</span>.<span class="me1">attr</span><span class="br0">&#40;</span><span class="st0">&quot;disabled&quot;</span><span class="sy0">,</span><span class="kw2">false</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createBeautifulCaptions<span class="br0">&#40;</span>global_full_captions<span class="br0">&#91;</span>len<span class="sy0">-</span>1<span class="br0">&#93;</span>.<span class="me1">captions</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setTimeout<span class="br0">&#40;</span>showAppropriateCaptions<span class="sy0">,</span>global_full_captions<span class="br0">&#91;</span>len<span class="sy0">-</span>1<span class="br0">&#93;</span>.<span class="me1">duration</span><span class="sy0">*</span>1000<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">if</span><span class="br0">&#40;</span><span class="br0">&#40;</span>global_full_captions<span class="br0">&#91;</span>i<span class="br0">&#93;</span>.<span class="me1">startTime</span> <span class="sy0">&lt;=</span> currTime <span class="sy0">&amp;&amp;</span> <span class="br0">&#40;</span>global_full_captions<span class="br0">&#91;</span>i<span class="sy0">+</span><span class="nu0">1</span><span class="br0">&#93;</span>.<span class="me1">startTime</span> <span class="sy0">&gt;</span> currTime<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// found the appropriate caption</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><span class="sy0">!</span>$<span class="br0">&#40;</span><span class="st0">&#8216;#previous&#8217;</span><span class="br0">&#41;</span>.<span class="me1">hasClass</span><span class="br0">&#40;</span><span class="st0">&#8216;enabled&#8217;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&quot;#previous&quot;</span><span class="br0">&#41;</span>.<span class="me1">addClass</span><span class="br0">&#40;</span><span class="st0">&#8216;enabled&#8217;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&quot;#previous&quot;</span><span class="br0">&#41;</span>.<span class="me1">attr</span><span class="br0">&#40;</span><span class="st0">&quot;disabled&quot;</span><span class="sy0">,</span><span class="kw2">false</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createBeautifulCaptions<span class="br0">&#40;</span>global_full_captions<span class="br0">&#91;</span>i<span class="br0">&#93;</span>.<span class="me1">captions</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// now call the same function before the start of the next caption</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setTimeout<span class="br0">&#40;</span>showAppropriateCaptions<span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Math.<span class="me1">abs</span><span class="br0">&#40;</span>global_full_captions<span class="br0">&#91;</span>i<span class="sy0">+</span>1<span class="br0">&#93;</span>.<span class="me1">startTime</span> <span class="sy0">-</span> global_full_captions<span class="br0">&#91;</span>i<span class="br0">&#93;</span>.<span class="me1">startTime</span><span class="br0">&#41;</span><span class="sy0">*</span>1000<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp;<span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>Now, for every word in that particular line of the caption, I broke it up into span elements and attached click handlers to each. The span elements look like this</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">p</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;mycaption&quot;</span> &gt;</span><br />
<span class="sc2">&lt;<span class="kw2">span</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;beautifulCaptions0&quot;</span>&gt;</span>to<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">span</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">span</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;beautifulCaptions1&quot;</span>&gt;</span>spend<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">span</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">span</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;beautifulCaptions2&quot;</span>&gt;</span>some<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">span</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">span</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;beautifulCaptions3&quot;</span>&gt;</span>good<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">span</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">span</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;beautifulCaptions4&quot;</span>&gt;</span>time<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">span</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">span</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;beautifulCaptions5&quot;</span>&gt;</span>with<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">span</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">span</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;beautifulCaptions6&quot;</span>&gt;</span>my<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">span</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">span</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;beautifulCaptions7&quot;</span>&gt;</span>good<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">span</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">span</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;beautifulCaptions8&quot;</span>&gt;</span>buddy<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">span</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">span</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;beautifulCaptions9&quot;</span>&gt;</span>Elmo<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">span</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">span</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;beautifulCaptions10&quot;</span>&gt;</span>over<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">span</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">span</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;beautifulCaptions11&quot;</span>&gt;</span>here.<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">span</span>&gt;</span><br />
<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">p</span>&gt;</span></div>
</div>
<p>When a word is clicked on the captions, the showASL method gets called and the word string is passed as a parameter. After stripping the words of extraneous characters like !, &#038;, ], [, ; etc and converting the word to lowercase, the method inserts an iframe on the right hand top corner whose URL points to </p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;">http://cats.gatech.edu/cats/MySignLink/dictionary/html/pages/{THE SELECTED WORD}.htm</div>
</div>
<p>The pages showing the ASL have flash videos embedded, so I have styled the iframe so that the flash video is at the center of the box. Some of the pages have just images and some may have both. Hence, I added the &#8220;Full Page View&#8221; button under the ASL box, so that viewers could see the entire page if they wanted to. </p>
<p>The SmartSign website covers around 25000 words and hence there will be words in the captions for which the ASL representation do not exist. For such cases, I get an image from <a href="http://www.bing.com">Bing </a>to substitute for the ASL.<br />
<strong>The source code is undergoing constant refactoring, and would love to get more ideas on how to design a better solution.</strong></p>
<h3>What lies ahead for Open-Captions? </h3>
<p>Currently, I am gathering feedback from hearing impaired users about Open-Captions and also getting thoughts on what additional features they would like. Harley, the researcher at CATS, is excited about this project too and reaching out to more people for feedback.<br />
Another idea is to build Open-Captions as the &#8220;Khan Academy&#8221; of ASL, by having videos that enable different levels of learning of ASL. </p>
]]></content:encoded>
			<wfw:commentRss>http://yaccessibilityblog.com/library/open-captions-meta-data-asl.html/feed</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>Enabling Full Keyboard Access on the Mac</title>
		<link>http://yaccessibilityblog.com/library/full-keyboard-access-mac.html</link>
		<comments>http://yaccessibilityblog.com/library/full-keyboard-access-mac.html#comments</comments>
		<pubDate>Tue, 18 Oct 2011 22:05:11 +0000</pubDate>
		<dc:creator>Todd Kloots</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[a11y]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[Keyboard accessibility]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://yaccessibilityblog.com/library/?p=1031</guid>
		<description><![CDATA[Full keyboard access isn't enabled by default in Mac OS.  Often this leaves developers thinking there is something wrong with the implementation of keyboard access for a site or application, when in fact it is just a matter of changing a few system and browser preferences.]]></description>
			<content:encoded><![CDATA[<p>Full keyboard access isn&#8217;t enabled by default in Mac OS.  Often this leaves developers thinking there is something wrong with the implementation of keyboard access for a site or application, when in fact it is just a matter of changing a few system and browser preferences.</p>
<p><span id="more-1031"></span></p>
<h3>Full Keyboard Access Explained</h3>
<p>
In the context of browsers on the Mac, the various &#8220;full keyboard access&#8221; preferences affect the behavior of the Tab key.  With the default settings applied (full keyboard access disabled), the Tab key moves focus between a subset of controls.  This subset varies between browsers on the Mac:
</p>
<table summary="How the behavior of the Tab key differs cross browser on the Mac">
<thead>
<tr>
<th>Browser</th>
<th>Default Tab Key Access</th>
</tr>
</thead>
<tbody>
<tr>
<td>Safari</td>
<td>
<ul>
<li>Most form controls requiring text input or selection</li>
<li>Custom controls made focusable via the <em>tabindex</em> attribute</li>
</ul>
</td>
</tr>
<tr>
<td>Firefox</td>
<td>
<ul>
<li>All form controls</li>
<li>Custom controls made focusable via the <em>tabindex</em> attribute</li>
</ul>
</td>
</tr>
<tr>
<td>Chrome</td>
<td>
<ul>
<li>All form controls</li>
<li>Custom controls made focusable via the <em>tabindex</em> attribute</li>
</ul>
</td>
</tr>
</tbody>
</table>
<h3>Enabling On the Fly</h3>
<p>Given the default settings on the Mac, how do keyboard users navigate and interact with controls that aren&#8217;t in the default Tab flow?</p>
<p>
Safari provides the Option key as a modifier for Tab.  Pressing Option + Tab will extend access to include links.  Additionally, Mac OS provides the global Ctrl + F7 keyboard shortcut which toggles the ability to access to all controls via the Tab key.  Together these shortcuts can provide a nice usability affordance; they give keyboard users more options with respect to how to navigate a page or application.
</p>
<p>
For users of Firefox, switching the behavior of the Tab key is as easy as it is for Safari.  Unlike Safari, Firefox provides access to <em>all controls</em> but links by default.  The Ctrl + F7 shortcut can be used to extend access to include links.
</p>
<p>
Chrome follows Firefox providing access to all controls but links by default, but doesn&#8217;t honor Ctrl + F7.  To modify the behavior of the Tab key, the user has to navigate into preferences.
</p>
<h3>Enabling via Preferences</h3>
<p>Rather than change full keyboard access on the fly, it is possible to make full keyboard access the default.</p>
<h4 id="ff-prefs">Firefox</h4>
<p>Firefox relies on the Keyboard settings in System Preferences.  Changing these preferences enables full keyboard access to not just Firefox, but all applications.</p>
<ol>
<li>Go to Keyboard in System Preferences in OS X</li>
<li>Find the &#8220;Full Keyboard Access&#8221; section at the bottom of the dialog</li>
<li>Check the &#8220;All Controls&#8221; radio button</li>
</ol>
<p>You can also press Ctrl + F7 to change this preference.</p>
<p><a href="http://yaccessibilityblog.com/library/wp-content/uploads/2011/10/osx-system-prefs.png"><img src="http://yaccessibilityblog.com/library/wp-content/uploads/2011/10/osx-system-prefs.png" alt="Keyboard Preferences in Mac OS" width="501" height="301" class="alignnone size-full wp-image-1043" /></a></p>
<h4 id="safari-prefs">Safari</h4>
<ol>
<li>Go to Safari &#62; Preferences &#62; Advanced</li>
<li>Check the &#8220;Press Tab to highlight each item on a webpage&#8221; checkbox</li>
</ol>
<p><a href="http://yaccessibilityblog.com/library/wp-content/uploads/2011/10/safari-prefs.png"><img src="http://yaccessibilityblog.com/library/wp-content/uploads/2011/10/safari-prefs.png" alt="Preferences dialog in Safari" width="500" height="337" class="alignnone size-full wp-image-1039" /></a></p>
<h4 id="chrome-prefs">Google Chrome</h4>
<ol>
<li>Go to Chrome &#62; Preferences &#62; Under the Hood</li>
<li>Check the &#8220;Pressing Tab on a webpage highlights links, as well as form fields&#8221; checkbox</li>
</ol>
<p><a href="http://yaccessibilityblog.com/library/wp-content/uploads/2011/10/chrome-prefs.png"><img src="http://yaccessibilityblog.com/library/wp-content/uploads/2011/10/chrome-prefs.png" alt="Under the Hood Preferences in Google Chrome" width="500" height="174" class="alignnone size-full wp-image-1037" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://yaccessibilityblog.com/library/full-keyboard-access-mac.html/feed</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>Techniques for High-Contrast-Friendly Icons</title>
		<link>http://yaccessibilityblog.com/library/high-contrast-friendly-icons.html</link>
		<comments>http://yaccessibilityblog.com/library/high-contrast-friendly-icons.html#comments</comments>
		<pubDate>Tue, 11 Oct 2011 20:33:47 +0000</pubDate>
		<dc:creator>Todd Kloots</dc:creator>
				<category><![CDATA[Images]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[high contrast]]></category>
		<category><![CDATA[icon]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[low vision]]></category>
		<category><![CDATA[sprite]]></category>

		<guid isPermaLink="false">http://yaccessibilityblog.com/library/?p=946</guid>
		<description><![CDATA[The most popular way of creating icons on the web is also completely inaccessible to some users.  Learn the techniques for creating icons that are accessible in High Contrast mode.]]></description>
			<content:encoded><![CDATA[<p>CSS background images are the most popular means of using image sprites, but this technique can cause problems for users of High Contrast mode in Windows.  Background images are disabled when High Contrast mode is enabled, causing all sprites to disappear.  For example, consider the following toolbar containing buttons labeled with icons created using background images:</p>
<p><img src="http://yaccessibilityblog.com/library/wp-content/uploads/2011/10/toolbar.png" alt="Screen shot of a toolbar with buttons labeled with icons created using background images"  width="213" height="63" class="alignnone size-full wp-image-1085" style="border:solid 1px #000;" /></p>
<p>Here is how the toolbar renders when High Contrast mode is enabled.</p>
<p><img src="http://yaccessibilityblog.com/library/wp-content/uploads/2011/10/toolbar-hc-mode.png" alt="Screen shot of a toolbar with buttons labeled with icons created using background images rendered in High Contrast mode"  width="218" height="66" class="alignnone size-full wp-image-1084" /></p>
<p>As illustrated, use of CSS background images can result in information loss for users when High Contrast mode is enabled, especially in the following use cases:</p>
<ul>
<li>An image is the only visual label for a UI control (e.g. a button, menuitem, etc.)</li>
<li>An image conveys state (e.g. selected, checked, etc.) or other supplemental information (e.g. a message has an attachment)</li>
</ul>
<p>This is especially problematic considering High Contrast mode is designed to make the UI <em>easier</em> to see.  Fortunately there are several alternatives to background images that work in High Contrast mode.</p>
<p><span id="more-946"></span></p>
<h3>Understanding High Contrast Mode</h3>
<p>First, what is High Contrast mode, and more importantly, who benefits?</p>
<p>In High Contrast mode Windows will change the foreground colors (used for text, borders, etc.) and background colors to create a greater contrast.  The font size is often increased as well. These adjustments make it easier for users with visual impairments to see the screen.</p>
<p>Some examples of the types of users who benefit from High Contrast mode are:</p>
<ul>
<li>Users who have <a href="http://en.wikipedia.org/wiki/Low_vision">low vision</a>; anyone with a visual impairment that can&#8217;t be corrected with glasses, but is not in the range of legal blindness.  Users with low vision may use screen magnification, bigger screens, larger fonts, high contrast, screen reading, or other assistive technology.  Users with low vision can perceive light, so more contrast can make it easier to see the screen.</li>
<li>Users with color vision deficiencies (also known as <a href="http://en.wikipedia.org/wiki/Color_blindness">color blindness</a>)</li>
<li>Users who&#8217;s eyes are sensitive to light.  Users can turn on low contrast theme or darker themes as their eyes are very sensitive to light.</li>
</ul>
<h3>Solutions</h3>
<p>There are several alternatives to using background images, each with benefits and drawbacks.  As with all accessibility solutions, there&#8217;s no silver bullet.  Consider each solution relative to the constraints or demands of the web site or application and choose the solution that works best.</p>
<h4 id="content-and-bgimg">Use the <em>content</em> property</h4>
<p><a href="http://www.paciellogroup.com/blog/2010/01/high-contrast-proof-css-sprites/">Steve Faulkner</a>, <a href="http://nicolasgallagher.com/css-image-replacement-with-pseudo-elements/">Nicolas Gallagher</a>, <a href="http://coding.smashingmagazine.com/2011/03/19/styling-elements-with-glyphs-sprites-and-pseudo-elements/">Thierry Koblentz</a>, have all authored articles on using the <a href="http://www.w3.org/TR/CSS2/generate.html#propdef-content"><em>content</em> property</a> to create icons that work in High Contrast mode.</p>
<p>Here&#8217;s how it works.  Consider the following HTML for a toolbar:</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">div</span> role<span class="sy0">=</span><span class="st0">&quot;toolbar&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;toolbar&quot;</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">button</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;button&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;prnt&quot;</span>&gt;</span>Print<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">button</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">button</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;button&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;find&quot;</span>&gt;</span>Find<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">button</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">button</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;button&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;save&quot;</span>&gt;</span>Save<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">button</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">button</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;button&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;sets&quot;</span>&gt;</span>Settings<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">button</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">button</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;button&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;info&quot;</span>&gt;</span>Info<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">button</span>&gt;</span><br />
<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span></div>
</div>
<p>To add an icon to each button:</p>
<ol>
<li>Give the button a fixed height and width, and set the <em>overflow</em> property to &#8220;hidden&#8221;.
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;"><span class="re1">.toolbar</span> button <span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">border</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="kw2">solid</span> <span class="re0">#333</span><span class="sy0">;</span><br />
&nbsp; <span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#bbb</span><span class="sy0">;</span><br />
&nbsp; <span class="kw1">padding</span><span class="sy0">:</span> <span class="nu0">0</span><span class="sy0">;</span><br />
&nbsp; <span class="kw1">margin</span><span class="sy0">:</span> 0 <span class="re3">3px</span> 0 <span class="nu0">0</span><span class="sy0">;</span><br />
&nbsp; <span class="kw1">width</span><span class="sy0">:</span> <span class="re3">36px</span><span class="sy0">;</span><br />
&nbsp; <span class="kw1">height</span><span class="sy0">:</span> <span class="re3">36px</span><span class="sy0">;</span><br />
&nbsp; <span class="kw1">overflow</span><span class="sy0">:</span> <span class="kw2">hidden</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
</li>
<li>Use the <em>:before</em> pseudo element and the <em>content</em> property to add the image to the button.
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;"><span class="re1">.toolbar</span> button<span class="re2">:before </span><span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">display</span><span class="sy0">:</span> inline-<span class="kw2">block</span><span class="sy0">;</span><br />
&nbsp; <span class="kw1">content</span><span class="sy0">:</span> <span class="kw2">url</span><span class="br0">&#40;</span><span class="st0">&#8216;http://findicons.com/files/icons/2340/preview/toolbar_icon_set_full.png&#8217;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
</li>
<li>Use negative margins to move the image into position.
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;"><span class="re1">.toolbar</span> <span class="re1">.prnt</span><span class="re2">:before </span><span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">-73px</span> 0 0 <span class="re3">-37px</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.toolbar</span> <span class="re1">.find</span><span class="re2">:before </span><span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">-145px</span> 0 0 <span class="re3">-181px</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.toolbar</span> <span class="re1">.save</span><span class="re2">:before </span><span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">-73px</span> 0 0 <span class="re3">-145px</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.toolbar</span> <span class="re1">.sets</span><span class="re2">:before </span><span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">-109px</span> 0 0 <span class="re3">-73px</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.toolbar</span> <span class="re1">.info</span><span class="re2">:before </span><span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">-145px</span> 0 0 <span class="re3">-145px</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
</li>
</ol>
<p>This CSS will inject an image before the button&#8217;s text node.  With the <em>overflow</em> property set to &#8220;hidden,&#8221; the text will be hidden from view while still being accessible to users of screen readers.</p>
<p>The technique has a number of advantages, the foremost being the changes are isolated to CSS.  So switching to this technique from background images doesn&#8217;t require a change to markup.  Other advantages include:</p>
<ul>
<li><a href="http://developer.yahoo.com/performance/rules.html#num_http">All the performance benefits of background images</a>.</li>
<li>Easy development of high contrast themes since icons are delivered via the CSS.</li>
<li>The images will print.</li>
</ul>
<p>The major disadvantage to this technique is the <em>content</em> property isn&#8217;t supported in IE &#60; 8.  But there are several solutions for supporting older versions of IE, the first being to consider support for High Contrast mode a <a href="http://en.wikipedia.org/wiki/Progressive_Enhancement">Progressive Enhancement</a>: Use <em>content</em> for modern browsers, fall back to background images for older versions of IE.</p>
<p>Here&#8217;s the CSS updated with support for IE 6 and 7.</p>
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;"><span class="re1">.toolbar</span> button<span class="re2">:before </span><span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">display</span><span class="sy0">:</span> inline-<span class="kw2">block</span><span class="sy0">;</span><br />
&nbsp; <span class="kw1">content</span><span class="sy0">:</span> <span class="kw2">url</span><span class="br0">&#40;</span><span class="st0">&#8216;http://findicons.com/files/icons/2340/preview/toolbar_icon_set_full.png&#8217;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.toolbar</span> button <span class="br0">&#123;</span><br />
&nbsp; <span class="sy0">*</span><span class="kw1">background</span><span class="sy0">:</span> <span class="kw2">url</span><span class="br0">&#40;</span><span class="st0">&#8216;http://findicons.com/files/icons/2340/preview/toolbar_icon_set_full.png&#8217;</span><span class="br0">&#41;</span> <span class="kw2">no-repeat</span><span class="sy0">;</span><br />
&nbsp; <span class="sy0">*</span><span class="kw1">text-indent</span><span class="sy0">:</span> <span class="re3">36px</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.toolbar</span> <span class="re1">.prnt</span> <span class="br0">&#123;</span><br />
&nbsp; <span class="sy0">*</span><span class="kw1">background-position</span><span class="sy0">:</span> <span class="re3">-38px</span> <span class="re3">-74px</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.toolbar</span> <span class="re1">.prnt</span><span class="re2">:before </span><span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">-73px</span> 0 0 <span class="re3">-37px</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.toolbar</span> <span class="re1">.find</span> <span class="br0">&#123;</span><br />
&nbsp; <span class="sy0">*</span><span class="kw1">background-position</span><span class="sy0">:</span> <span class="re3">-182px</span> <span class="re3">-146px</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.toolbar</span> <span class="re1">.find</span><span class="re2">:before </span><span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">-145px</span> 0 0 <span class="re3">-181px</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.toolbar</span> <span class="re1">.save</span> <span class="br0">&#123;</span><br />
&nbsp; <span class="sy0">*</span><span class="kw1">background-position</span><span class="sy0">:</span> <span class="re3">-146px</span> <span class="re3">-74px</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.toolbar</span> <span class="re1">.save</span><span class="re2">:before </span><span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">-73px</span> 0 0 <span class="re3">-145px</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.toolbar</span> <span class="re1">.sets</span> <span class="br0">&#123;</span><br />
&nbsp; <span class="sy0">*</span><span class="kw1">background-position</span><span class="sy0">:</span> <span class="re3">-74px</span> <span class="re3">-110px</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.toolbar</span> <span class="re1">.sets</span><span class="re2">:before </span><span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">-109px</span> 0 0 <span class="re3">-73px</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.toolbar</span> <span class="re1">.info</span> <span class="br0">&#123;</span><br />
&nbsp; <span class="sy0">*</span><span class="kw1">background-position</span><span class="sy0">:</span> <span class="re3">-146px</span> <span class="re3">-146px</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.toolbar</span> <span class="re1">.info</span><span class="re2">:before </span><span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">-145px</span> 0 0 <span class="re3">-145px</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>Use <a href="http://lesscss.org/">LESS</a> or <a href="http://sass-lang.com/">Sass</a> to make the fork for IE more manageable.  Here&#8217;s an example of the previous CSS consolidated using LESS:</p>
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;"><span class="re1">.positionIcon</span> <span class="br0">&#40;</span><span class="co1">@x, @y) {</span><br />
&nbsp; &amp;<span class="re2">:before </span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">margin</span><span class="sy0">:</span> <span class="co1">@y 0 0 @x;</span><br />
&nbsp; <span class="br0">&#125;</span><br />
&nbsp; <span class="sy0">*</span><span class="kw1">background-position</span><span class="sy0">:</span> <span class="co1">@x &#8211; 1px @y &#8211; 1px;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.toolbar</span> <span class="re1">.prnt</span> <span class="br0">&#123;</span> <br />
&nbsp; .positionIcon<span class="br0">&#40;</span><span class="re3">-37px</span><span class="sy0">,</span> <span class="re3">-73px</span><span class="br0">&#41;</span><span class="sy0">;</span> <br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.toolbar</span> <span class="re1">.find</span> <span class="br0">&#123;</span> <br />
&nbsp; .positionIcon<span class="br0">&#40;</span><span class="re3">-181px</span><span class="sy0">,</span> <span class="re3">-145px</span><span class="br0">&#41;</span><span class="sy0">;</span> <br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.toolbar</span> <span class="re1">.save</span> <span class="br0">&#123;</span> <br />
&nbsp; .positionIcon<span class="br0">&#40;</span><span class="re3">-145px</span><span class="sy0">,</span> <span class="re3">-73px</span><span class="br0">&#41;</span><span class="sy0">;</span> &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.toolbar</span> <span class="re1">.sets</span> <span class="br0">&#123;</span> <br />
&nbsp; .positionIcon<span class="br0">&#40;</span><span class="re3">-73px</span><span class="sy0">,</span> <span class="re3">-109px</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.toolbar</span> <span class="re1">.info</span> <span class="br0">&#123;</span> <br />
&nbsp; .positionIcon<span class="br0">&#40;</span><span class="re3">-145px</span><span class="sy0">,</span> <span class="re3">-145px</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>Here&#8217;s an example of how it all comes together: <a href="http://yaccessibilityblog.com/examples/highcontrast/using-content-and-bgimg.html">high-contrast-friendly icons using the <em>content</em> property and background images for IE 6 &#038; 7</a>.</p>
<h4 id="img-sprites">Use &#60;img&#62; sprites</h4>
<p>Rather than use the CSS <em>content</em> property to add an image, insert the &#60;img&#62; directly into the markup.</p>
<p>The CSS for positioning the image is virtually identical to the <em>content</em> property technique, the difference being the style rules address the &#60;img&#62; rather than the <em>:before</em> pseudo element.</p>
<p>Here&#8217;s an example: <a href="http://yaccessibilityblog.com/examples/highcontrast/using-img-element.html">high-contrast-friendly icons using the &#60;img&#62; element</a></p>
<p><a href="http://tjkdesign.com/articles/how-to_use_sprites_with_my_Image_Replacement_technique.asp">Credit for this technique goes to Thierry Koblenz</a>, and <a href="http://www.artzstudio.com/2010/04/img-sprites-high-contrast/">Artz Studio published a good article on the subject</a>.  </p>
<p>This technique works in all browsers, making it a good choice when support for High Contrast mode in older versions of IE is required.  There are some disadvantages to this technique, mainly:</p>
<ul>
<li>Harder to theme with the path to the image in the markup.</li>
<li>Because negative margins are used to position the image, the alternative text won&#8217;t be displayed when images are disabled or fail to load but CSS is enabled.</li>
</ul>
<h4 id="content-and-expression">Use <em>content</em> for modern browsers and CSS expressions for IE 6 &#038; 7</h4>
<p>The final solution would be to use a CSS expression to supplement the lack of support for the <em>content</em> property in IE 6 and 7.</p>
<p>The major advantage to this technique is the CSS expression provides the flexibility of the <em>content</em> property; the path to the image is centralized in the CSS, enabling the creation of themes.  The disadvantage to this technique is <a href="http://developer.yahoo.com/blogs/ydn/posts/2007/07/high_performanc_6/">CSS expressions have the potential to cause performance problems</a>.  To help mitigate slowness, this technique uses <a href="http://stevesouders.com/hpws/onetime-expressions.php">Steve Souder&#8217;s recommended one-time expressions solution</a>.</p>
<p>Here&#8217;s an example of this technique: <a href="http://yaccessibilityblog.com/examples/highcontrast/using-content-and-expression.html">high-contrast-friendly icons using the <em>content</em> property and CSS expressions for IE 6 &#038; 7</a>.</p>
<p>This technique might be a good choice when support for High Contrast mode in older versions of IE is required and the given site or application doesn&#8217;t have many instances of icons.  But as with all things performance, <a href="http://ajax.dynatrace.com/ajax/"><em>measure</em> the performance impact of the CSS expressions</a> before putting them into production.</p>
<h3 id="testing">Testing High Contrast Mode</h3>
<p>Regardless of the technique, it is important to test in High Contrast mode.  For more on enabling High Contrast mode, see Microsoft&#8217;s documentation:</p>
<ul>
<li><a href="http://windows.microsoft.com/en-US/windows-xp/help/turn-on-high-contrast">Enabling High Contrast mode in Windows XP</a></li>
<li><a href="http://windows.microsoft.com/en-US/windows7/Make-the-computer-easier-to-see-optimize-visual-display">Enabling High Contrast mode in Windows 7</a></li>
</ul>
<h3>Recommendation</h3>
<p>Of the three, <a href="http://yaccessibilityblog.com/examples/highcontrast/using-content-and-bgimg.html">using the <em>content</em> property with background images for IE 6 and 7</a> seems like the preferred solution.  It strikes the right balance between what is desirable for both the developer and the user.  For developers it provides both an easy means of fixing icons for existing sites, while being a future-proof accessibility design pattern for the development of new sites.  Although IE 6 + 7 users will be required to upgrade their browser for High Contrast mode support, it&#8217;s a solution geared toward the future, rather than browsers with declining marketshare.  So, while it might not be a silver bullet today, it&#8217;s close.  And it certainly will be once IE 6 and 7 are gone.</p>
<p>Ultimately, the choice is yours.  Use the <a href="http://yaccessibilityblog.com/examples/highcontrast/comparison.html">comparison table</a> to help guide your decision, as it&#8217;s designed to clearly call out the pros and cons of each technique.</p>
<h4>RTL Support</h4>
<p>Vertically arrange icons in the sprite for right-to-left (RTL) language support.  This will ensure the icons are positioned correctly regardless of the orientation of the screen.</p>
<h4>Muscle Memory</h4>
<p>Often the biggest hurdle for implementing new techniques is changing habits.  While CSS background images continue to be useful for images used for decoration (e.g. gradients), consider this new technique whenever CSS is used to replace text on screen with an image.  That should help put it in muscle memory.</p>
]]></content:encoded>
			<wfw:commentRss>http://yaccessibilityblog.com/library/high-contrast-friendly-icons.html/feed</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>Easy Fixes to Common Accessibility Problems</title>
		<link>http://yaccessibilityblog.com/library/easy-fixes-to-common-accessibility-problems.html</link>
		<comments>http://yaccessibilityblog.com/library/easy-fixes-to-common-accessibility-problems.html#comments</comments>
		<pubDate>Thu, 06 Oct 2011 15:41:32 +0000</pubDate>
		<dc:creator>Todd Kloots</dc:creator>
				<category><![CDATA[Forms]]></category>
		<category><![CDATA[Images]]></category>
		<category><![CDATA[ARIA]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Easy Fixes]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[label]]></category>
		<category><![CDATA[Progressive Enhancement]]></category>
		<category><![CDATA[role]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://yaccessibilityblog.com/library/?p=874</guid>
		<description><![CDATA[Many common accessibility problems have an easy fix.  Learn the simple changes you can make to get started on improving the accessibility of your web site or application.

]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/anniebee/3103987824/" title="easy by anniebee, on Flickr"><img src="http://farm4.static.flickr.com/3239/3103987824_05b897e9a3_t.jpg" width="100" height="80" alt="easy" class="alignright"></a>Making a site or application accessible can seem so overwhelming that it can completely stall efforts before they begin.  But sometimes simple changes can provide the necessary momentum while resulting in significant improvements for users.</p>
<p>So, in the spirit of small things that make a big difference, here's a list of fixes for common accessibility problems.</p>
<span id="more-874"></span>
<div class="yui3-collapsible-sections solutions">

<h3 id="focus">Show focus</h3>
<p>
CSS reset files often suppress default browser focus styles.  As a result, developers and designers can forget to style the focused state for UI controls.  Without focus styles the user is unable to navigate via keyboard.
</p>
<h4>Styling focus</h4>
<div class="solution">
<p>Unplug the mouse and use the Tab key to move focus through the interactive controls (e.g. links, buttons, form controls, etc.) on the page.  Identify the controls that lack a focus style and then update the CSS.  Commonly used properties for styling focus are <em>outline</em>, <em>box-shadow</em> and <em>background-color</em> as they don't impact layout.  For example:
</p>
<div class="codesnip-container" ><div class="css codesnip" style="font-family:monospace;">button<span class="re2">:focus </span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw1">outline</span><span class="sy0">:</span> <span class="kw2">dotted</span> <span class="re3">1px</span> <span class="re0">#000</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div></div>
<p><em>Note:</em> IE6 doesn't support the :focus pseudo class.  It does support :active, but only on anchor elements.  IE 6 will render a default focus outline around all focusable elements as long as it hasn't been disabled via the <a href="http://msdn.microsoft.com/en-us/library/ms533783(v=vs.85).aspx"><em>hidefocus attribute</em></a>.   For IE 6 best to just confirm the default browser focus is visible and consider custom focus styles a form of Progressive Enhancement.
</p>
</div>


<h3 id="aria-button">Use the <em>button</em> role to make link buttons into, er&hellip; buttons</h3>
<p>Links are often used to create buttons.  When an element is focused, screen readers announce its tag name.  That means users of screen readers will perceive link buttons as links.  Worse, the value of the link's href may be announced.  This can be especially confusing to the user if the href is set to "#" or "javascript:&hellip;".</p>
<h4>Using the <em>button</em> role</h4>
<div class="solution">
<p>For link buttons, simply add the ARIA <a href="http://www.w3.org/TR/wai-aria/complete#button"><em>button</em></a> role.</p>
<div class="codesnip-container" ><div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">a</span> role<span class="sy0">=</span><span class="st0">&quot;button&quot;</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span>&gt;</span>Click Me<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">a</span> role<span class="sy0">=</span><span class="st0">&quot;button&quot;</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;javascript:callback();&quot;</span>&gt;</span>Click Me<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">a</span> role<span class="sy0">=</span><span class="st0">&quot;button&quot;</span> <span class="kw3">tabindex</span><span class="sy0">=</span><span class="st0">&quot;0&quot;</span>&gt;</span>Click Me<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;</span></div></div>
<p>For buttons created using another element (like a &#60;span&#62;), add the <em>button</em> role.  Set the <em>tabindex</em> to 0 to place the button into the default tab flow.</p>
<div class="codesnip-container" ><div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">span</span> role<span class="sy0">=</span><span class="st0">&quot;button&quot;</span> <span class="kw3">tabindex</span><span class="sy0">=</span><span class="st0">&quot;0&quot;</span>&gt;</span>Click Me<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">span</span>&gt;</span></div></div>
<p>Another solution is to simply just use a <a href="http://www.w3.org/TR/html4/interact/forms.html#edef-BUTTON">&#60;button&#62;</a> for buttons.</p>
<div class="codesnip-container" ><div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">button</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;button&quot;</span>&gt;</span>Click Me<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">button</span>&gt;</span></div></div>
<p>This bookmarklet can help identify link buttons that could benefit from an ARIA role of <em>button</em>:<br><a href="javascript:(function(){function loadYUI(callback){var version,script;if(typeof YUI!=='undefined'&&(version=YUI.version)&&version.split('.')[1]>=4){callback();}else{script=document.createElement('script');script.type='text/javascript';if(script.readyState){script.onreadystatechange=function(){if(script.readyState==='loaded'||script.readyState==='complete'){script.onreadystatechange=null;callback();}};}else{script.onload=callback;}script.src='http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js';document.getElementsByTagName('head')[0].appendChild(script);}}loadYUI(function(){YUI({gallery:'gallery-2011.09.28-20-29'}).use('gallery-a11ychecker-ui',function(Y){Y.a11ychecker.showLinkButtons();});});}());">Show Link Buttons</a></p>
</div>


<h3 id="labels">Label UI Controls</h3>
<p>UI controls sometimes go unlabeled.  Screen readers announce a control's label when it receives focus, so without text labels users of screen readers are unaware of a control's purpose or function.  Text labels also focus their associated form control when clicked, a nice usability affordance for smaller controls like checkboxes and radio buttons.</p>
<h4>Labeling techniques</h4>
<div class="solution">
<p>The following is a comprehensive list of labeling techniques for UI controls.</p>
<h5>Inner text</h5>
<p>Text placed between the opening and closing tags.  If the design doesn't require the text label be visible, <a href="http://snook.ca/archives/html_and_css/hiding-content-for-accessibility">hide it in an accessible way using CSS</a>.</p>
<h5><a href="http://www.w3.org/TR/html401/interact/forms.html#edef-LABEL">&#60;label&#62; element</a></h5>
<p>Tried and true method of labeling form controls.  If the design doesn't require the text label be visible, <a href="http://snook.ca/archives/html_and_css/hiding-content-for-accessibility">hide it in an accessible way using CSS</a>.</p>
<p><em>Note:</em>Implicit labeling is broken in IE 6.  In the following example clicking the label text won't focus the associated form control.</p>
<div class="codesnip-container" ><div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">label</span>&gt;</span>First Name <span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text&quot;</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;first-name&quot;</span>&gt;&lt;<span class="sy0">/</span><span class="kw2">label</span>&gt;</span></div></div>
<h5><a href="http://www.w3.org/TR/html401/struct/global.html#adef-title">title attribute</a></h5>
<p>Use <em>title</em> to label frames.  Might also be a good last resort if you are constrained for space (like a form element in a table cell). Otherwise, <a href="http://www.paciellogroup.com/blog/2010/11/using-the-html-title-attribute/"><em>title</em> isn't a good choice as a labeling technique</a>.</p>
<h5><a href="http://www.w3.org/TR/html401/struct/objects.html#adef-alt">alt attribute</a></h5>
<p>Used to label an image.  <a href="http://search.yahoo.com/search?q=writing+good+alt+text">There's no shortage of guidelines for writing good alt text</a>, but here's some things to keep in mind:  
<ul>
    <li>Use an empty string for decorative images, or if there's no text available.</li>
    <li>If the image contains text, replicate it in the <em>alt</em> attribute.</li>
    <li>Otherwise, try to be succinct.</li>
    <li>Under no circumstances omit the <em>alt</em> attribute.  An empty string is better than nothing.</li>
</ul>
<h5><a href="http://www.w3.org/TR/wai-aria/complete#aria-label">aria-label attribute</a></h5>
<p>Specifies the text label inline, but isn't visually rendered.  Handy when there's no space for label on screen and  <em>title</em> is already used to supply an instructional tooltip for sighted users.  For example a checkbox in a table cell: 
<div class="codesnip-container" ><div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;checkbox&quot;</span> aria-<span class="kw3">label</span><span class="sy0">=</span><span class="st0">&quot;Message 1&quot;</span> <span class="kw3">title</span><span class="sy0">=</span><span class="st0">&quot;Click to select this message&quot;</span>&gt;</span></div></div></p>
<p><em>Note:</em><em>aria-label</em> is not currently supported in Internet Explorer (9).</p>
<h5><a href="http://www.w3.org/TR/wai-aria/complete#aria-labelleby">aria-labelledby attribute</a></h5>
<p>Specifies the id(s) of the element(s) whose text content labels the control.  Useful when the desired label text is already present in another element in the DOM.  Saves the creation of another &#60;label&#62; element.</p>
<h5><a href="http://www.w3.org/TR/wai-aria/complete#aria-describedby">aria-describedby attribute</a></h5>
<p>Specifies the id(s) of the element(s) whose text provides a description supplemental to the label.  For example: an error message associated with a form field that has invalid user input.</p>
<p>This bookmarklet can help identify UI controls without labels:<br><a href="javascript:(function(){function loadYUI(callback){var version,script;if(typeof YUI!=='undefined'&&(version=YUI.version)&&version.split('.')[1]>=4){callback();}else{script=document.createElement('script');script.type='text/javascript';if(script.readyState){script.onreadystatechange=function(){if(script.readyState==='loaded'||script.readyState==='complete'){script.onreadystatechange=null;callback();}};}else{script.onload=callback;}script.src='http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js';document.getElementsByTagName('head')[0].appendChild(script);}}loadYUI(function(){YUI({gallery:'gallery-2011.09.28-20-29'}).use('gallery-a11ychecker-ui',function(Y){Y.a11ychecker.showLabelErrors();});});}());">Check Labels</a></p>
</div>


<h3 id="required-fields">Add the <em>required</em> attribute to required fields</h3>
<p>Required fields are often indicated using visual style, or an asterisk adjacent to the field's label.  As these solutions rely either entirely, or mostly on visual style they are completely inaccessible to users who can't see the screen.</p>
<h4>Using <em>required</em></h4>
<div class="solution">
<p>HTML5 adds a <em>required</em> attribute to form controls.  To supplement lack of browser support for <em>required</em>, use it together with <em>aria-required</em>.  When a required field is focused, the screen reader will announce that it is required.  Even better, it doesn't require localization because the required message is localized by the screen reader.</p>
<div class="codesnip-container" ><div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">&quot;first-name&quot;</span>&gt;</span>First<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">label</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text&quot;</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;first-name&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;first-name&quot;</span> required aria-required<span class="sy0">=</span><span class="st0">&quot;true&quot;</span>&gt;</span></div></div>
</div>


<h3 id="invalid-input">Indicate invalid input using <em>aria-invalid</em></h3>
<p>Invalid user input leaves users seeing red.  Unable to see the screen, users of screen readers can struggle to find the fields with errors.</p>
<h4>Using <em>aria-invalid</em></h4>
<div class="solution">
<p>Indicate invalid user input using <a href="http://www.w3.org/TR/wai-aria/complete#aria-invalid"><em>aria-invalid</em></a>.  Use <em>aria-describedby</em> to associate an error message with a form field.</p>
<div class="codesnip-container" ><div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">&quot;first-name&quot;</span>&gt;</span>First<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">label</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text&quot;</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;first-name&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;first-name&quot;</span> required aria-required<span class="sy0">=</span><span class="st0">&quot;true&quot;</span> aria-invalid<span class="sy0">=</span><span class="st0">&quot;true&quot;</span> aria-describedby<span class="sy0">=</span><span class="st0">&quot;err-msg&quot;</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">p</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;err-msg&quot;</span>&gt;</span>Cannot be blank.<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">p</span>&gt;</span></div></div>
</div>

<h3 id="dupe-links">Remove duplicate links, improve tab flow</h3>
<p>Keyboard users navigate between interactive elements via the Tab key.  Every anchor element creates a tab stop, so redundant links within a module can create an inefficient overall tab flow, making navigating with the Tab key a real drag for keyboard users.</p>
<h4>Improving tab flow</h4>
<div class="solution">
<h5>Use <em>tabindex=-1</em> to improve tab flow</h5>
<p>Setting <em>tabindex</em> to -1 removes an element from the tab flow, while keeping it clickable for users of the mouse.  This can be used to significantly improve the tab flow of a page.</p>
<p>Consider the following content module: The headline, image, and "More" text are all wrapped in individual links, all of which share  the same URL.</p>
<img src="http://yaccessibilityblog.com/library/wp-content/uploads/2011/10/news-problem.png" alt="A screen capture of an excerpt of a story on Yahoo! News with duplicate links highlighted in red" width="594" height="97" />
<p>This content module has three tab stops.  Reduce it to one by setting the tabindex to -1 for the links wrapping the image and "more" text.  This change makes a significant improvement to the tab flow when there are multiple instances of this module on a page.  In this example, each section has just one tab stop (the heading) instead of three.</p>
<img src="http://yaccessibilityblog.com/library/wp-content/uploads/2011/10/news-fixed.png" alt="A screen capture of a section of Yahoo! News illustrating the links that should be removed from the tab flow " width="600" height="255" />
<h5>Use a single link</h5>
<p>If a module contains two adjacent pieces of content and both should be linked to the same URL, wrap both inside a single link.</p>
<p>Consider the following example, where headlines and videos are paired together but the video and text labels are wrapped in separate links.  Duplicate links are outlined in red.</p>
<img src="http://yaccessibilityblog.com/library/wp-content/uploads/2011/10/news-problem-2.png" alt="A screen capture of a section of Yahoo! News with duplicate links highlighted in red" width="598" height="189" />
<p>
Placing the video and text inside one anchor would improve the tab flow of this section.  And don't forget, HTML5 enables anchor elements to contain block-level elements, making this approach valid code.
</p>
</div>


<h3 id="dupe-link-label">Add a description to make dupe link labels more accessible</h3>
<p>Pages often contain many instances of links with the same label.  Consider, "read more" links that follow truncated content or excerpts.  Without unique labels, users of screen readers can have trouble distinguishing one link from another.</p>
<h4>Adding a description to a link</h4>
<div class="solution">
<p>This content module has six links with the label "More".</p>
<img src="http://yaccessibilityblog.com/library/wp-content/uploads/2011/10/travel-more-links.png" alt="A screen capture of a section of Yahoo! Travel with duplicate link labels highlighted in red." width="599" height="373" />
<p>This screencast illustrates the user experience for browsing the links in this module using a screen reader</p>
<iframe title="Screencast illustrating the experience of duplicate link labels" width="425" height="349" src="http://www.youtube.com/embed/k5kO6lxnAjE?hl=en&fs=1" frameborder="0" allowfullscreen></iframe>
<p>Use <em>aria-describedby</em> to give each "More" link a unique description.  In this example, <em>aria-describedby</em> is set to the <em>id</em> of the other link in the module that contains a meaningful description for the "More" link.</p>
<div class="codesnip-container" ><div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;article&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">a</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;link-1&quot;</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;http://www.viator.com/Orlando/d663-ttd&quot;</span>&gt;</span>Orlando tours <span class="sc1">&amp;amp;</span> things to do<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">div</span>&gt;</span>provided by Viator guides<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">div</span>&gt;</span>Book Orlando tours, things to do, and day trips from Viator.com, including<span class="sc1">&amp;nbsp;</span>...<span class="sc1">&amp;nbsp;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">a</span> aria-describedby<span class="sy0">=</span><span class="st0">&quot;link-1&quot;</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;http://www.viator.com/Orlando/d663-ttd&quot;</span>&gt;</span>More<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span><br />
<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span></div></div>
<p>This screencast illustrates how the description for each "More" link is announce to the user by the screen reader.</p>
<iframe title="Screencast illustrating duplicate link labels made accessible using the aria-describedby attribute" width="425" height="349" src="http://www.youtube.com/embed/kFQrHp9zCNY?hl=en&fs=1" frameborder="0" allowfullscreen></iframe>
<p>This bookmarklet can help identify links with duplicate labels:<br><a href="javascript:(function(){function loadYUI(callback){var version,script;if(typeof YUI!=='undefined'&&(version=YUI.version)&&version.split('.')[1]>=4){callback();}else{script=document.createElement('script');script.type='text/javascript';if(script.readyState){script.onreadystatechange=function(){if(script.readyState==='loaded'||script.readyState==='complete'){script.onreadystatechange=null;callback();}};}else{script.onload=callback;}script.src='http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js';document.getElementsByTagName('head')[0].appendChild(script);}}loadYUI(function(){YUI({gallery:'gallery-2011.09.28-20-29'}).use('gallery-a11ychecker-ui',function(Y){Y.a11ychecker.showDupeLinkLabels();});});}());">Show Duplicate Link Labels</a></p>
</div>


<h3 id="hide-iframes">Use the <em>presentation</em> role to hide iframes in plain sight</h3>
<p>Iframes are sometimes used for purposes other than serving content (e.g. shims, async requests, etc.).  These iframes can be problematic for users of screen readers in that they both add an extra tab stop into the page, and can mislead users into thinking they contain content.</p>
<h4>Using the <em>presentation</em> role</h4>
<div class="solution">
<p>Apply the ARIA <a href="http://www.w3.org/TR/wai-aria/complete#presentation"><em>presentation</em></a> role to hide the iframe from screen readers.  Set <em>tabindex</em> to -1 to remove the iframe from the tab flow.</p>
<div class="codesnip-container" ><div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">iframe</span> role<span class="sy0">=</span><span class="st0">&quot;presentation&quot;</span> <span class="kw3">tabindex</span><span class="sy0">=</span><span class="st0">&quot;-1&quot;</span>&gt;&lt;<span class="sy0">/</span><span class="kw2">iframe</span>&gt;</span></div></div>
</div>


<h3 id="label-iframes">Label iframes with a title</h3>
<p>Iframes are used to sandbox content or functionality (e.g. Like Button, Tweet Button, etc.), but frequently lack a <em>title</em>.  This leaves users of screen readers unaware of the iframe's purpose.  Worse, the user may have to listen as the screen reader announces a long URL specified by the iframe's <em>src</em>.</p>
<h4>Using <em>title</em></h4>
<div class="solution">
<p>Here's a simple example illustrating how to use <em>title</em> to make the Facebook Like button more accessible.</p>
<div class="codesnip-container" ><div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">iframe</span> <span class="kw3">title</span><span class="sy0">=</span><span class="st0">&quot;Like this page on Facebook&quot;</span> <span class="kw3">src</span><span class="sy0">=</span><span class="st0">&quot;http://www.facebook.com/plugins/activity.php?site=news.yahoo.com&amp;width=290&amp;height=300&amp;header=false&amp;colorscheme=light&amp;font&amp;border_color=white&amp;recommendations=true&quot;</span> <span class="kw3">frameborder</span><span class="sy0">=</span><span class="st0">&quot;0&quot;</span> <span class="kw3">scrolling</span><span class="sy0">=</span><span class="st0">&quot;no&quot;</span> <span class="kw3">style</span><span class="sy0">=</span><span class="st0">&quot;width:290px;height:300px;&quot;</span>&gt;&lt;<span class="sy0">/</span><span class="kw2">iframe</span>&gt;</span></div></div>
</div>
</div>

<h3 id="bookmarklets">Bookmarklets from this article</h3>
<ul>
<li><a href="javascript:(function(){var%20ua=navigator.userAgent.toLowerCase(),ie=ua.indexOf("msie")!=-1?ua.substr(ie+5,1):0,outlineProp=ie<8?"border":"outline",activeItem;function%20styleFocus(e){if(activeItem){activeItem.style[outlineProp]="";}activeItem=e.target||e.srcElement;if(activeItem){activeItem.style[outlineProp]="solid%202px%20red";}}if(document.addEventListener){document.addEventListener("focus",styleFocus,true);}else{document.attachEvent("onfocusin",styleFocus);}}());" title="drag this link to your bookmark toolbar for future use">Show Focus</a></li>
<li><a title="drag this link to your bookmark toolbar for future use" href="javascript:(function(){function loadYUI(callback){var version,script;if(typeof YUI!=='undefined'&&(version=YUI.version)&&version.split('.')[1]>=4){callback();}else{script=document.createElement('script');script.type='text/javascript';if(script.readyState){script.onreadystatechange=function(){if(script.readyState==='loaded'||script.readyState==='complete'){script.onreadystatechange=null;callback();}};}else{script.onload=callback;}script.src='http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js';document.getElementsByTagName('head')[0].appendChild(script);}}loadYUI(function(){YUI({gallery:'gallery-2011.09.28-20-29'}).use('gallery-a11ychecker-ui',function(Y){Y.a11ychecker.showLinkButtons();});});}());">Show Link Buttons</a></li>
<li><a  title="drag this link to your bookmark toolbar for future use"  href="javascript:(function(){function loadYUI(callback){var version,script;if(typeof YUI!=='undefined'&&(version=YUI.version)&&version.split('.')[1]>=4){callback();}else{script=document.createElement('script');script.type='text/javascript';if(script.readyState){script.onreadystatechange=function(){if(script.readyState==='loaded'||script.readyState==='complete'){script.onreadystatechange=null;callback();}};}else{script.onload=callback;}script.src='http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js';document.getElementsByTagName('head')[0].appendChild(script);}}loadYUI(function(){YUI({gallery:'gallery-2011.09.28-20-29'}).use('gallery-a11ychecker-ui',function(Y){Y.a11ychecker.showLabelErrors();});});}());">Check Labels</a></li>
<li><a  title="drag this link to your bookmark toolbar for future use"  href="javascript:(function(){function loadYUI(callback){var version,script;if(typeof YUI!=='undefined'&&(version=YUI.version)&&version.split('.')[1]>=4){callback();}else{script=document.createElement('script');script.type='text/javascript';if(script.readyState){script.onreadystatechange=function(){if(script.readyState==='loaded'||script.readyState==='complete'){script.onreadystatechange=null;callback();}};}else{script.onload=callback;}script.src='http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js';document.getElementsByTagName('head')[0].appendChild(script);}}loadYUI(function(){YUI({gallery:'gallery-2011.09.28-20-29'}).use('gallery-a11ychecker-ui',function(Y){Y.a11ychecker.showDupeLinkLabels();});});}());">Show Duplicate Link Labels</a></li>
</ul>

Feature Image: <a href="http://www.flickr.com/photos/anniebee/3103987824/in/photostream/">Easy</a> 									<span class="ccIcn ccIcnSmall"><a href="http://creativecommons.org/licenses/by-nc-nd/2.0/"><img src="http://l.yimg.com/g/images/cc_icon_attribution_small.gif" alt="Attribution" title="Attribution" border="0"><img src="http://l.yimg.com/g/images/cc_icon_noncomm_small.gif" alt="Noncommercial" title="Noncommercial" border="0"><img src="http://l.yimg.com/g/images/cc_icon_noderivs_small.gif" alt="No Derivative Works" title="No Derivative Works" border="0"></a></span>
 <a href="http://creativecommons.org/licenses/by-nc-nd/2.0/" title="Attribution-NonCommercial-NoDerivs License">Some rights reserved</a> by <a href="/photos/anniebee/">anniebee</a>]]></content:encoded>
			<wfw:commentRss>http://yaccessibilityblog.com/library/easy-fixes-to-common-accessibility-problems.html/feed</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>Create Dynamic Form Labels with ARIA</title>
		<link>http://yaccessibilityblog.com/library/dynamic-form-labels-aria.html</link>
		<comments>http://yaccessibilityblog.com/library/dynamic-form-labels-aria.html#comments</comments>
		<pubDate>Thu, 18 Aug 2011 20:56:44 +0000</pubDate>
		<dc:creator>Ted Drake</dc:creator>
				<category><![CDATA[Forms]]></category>
		<category><![CDATA[ARIA]]></category>
		<category><![CDATA[aria-labelledby]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Labels]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://yaccessibilityblog.com/library/?p=729</guid>
		<description><![CDATA[Use aria-labelledby to create a dynamic form that is more responsive to a user.]]></description>
			<content:encoded><![CDATA[<p>Many times <a href="/library/tag/aria" ><abbr title="Accessible Rich Internet Applications">ARIA</abbr></a> is used as a quick fix for accessibility issues caused when more semantic elements should have been used. For instance, an input could use  aria-label when the design for the page does not include a visible label tag. Another common use is role=&quot;button&quot; when links are used for actions instead of the semantic button. ARIA roles and attributes provide simple solutions to low-hanging fruit; something developers with legacy code and screen reader users can appreciate.</p>

<span id="more-729"></span>

<p><img src="http://yaccessibilityblog.com/library/wp-content/uploads/2011/08/aria-labelledby-small.png" alt="aria-labelledby powered dynamic form representation" title="aria-labelledby-small" width="250" height="97" class="alignright size-full wp-image-744" />This post, however, will show how ARIA can make a dynamic form more responsive to a user. We have a contact input form for the user to add an email address type and value. We're going to use ARIA and JavaScript to give that text input a type-specific label by grabbing the information from the option previously selected. It's actually quite simple and ingenious.</p>
<h3>Use aria-labelledby to reference the input's label </h3>
<p>Normally a form input is referenced by a label.</p>
<div class="codesnip-container" ><div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">&quot;search&quot;</span>&gt;</span>Search your contact list<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">label</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;search&quot;</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;search&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;search&quot;</span>&gt;</span></div></div>

<p>The <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-labelledby">aria-labelledby</a> attribute lets the input reference another element on the page as its label. This allows everything from headers, paragraphs, and other form elements to act as a label for the input. The following example uses a module's h3 header as the label for a search input.</p>
<div class="codesnip-container" ><div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">h3</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;search-header&quot;</span>&gt;</span>Search your contact list<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">h3</span>&gt;</span><br />
<span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;search&quot;</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;search&quot;</span> aria-labelledby<span class="sy0">=</span><span class="st0">&quot;search-header&quot;</span>&gt;</span></div></div>
<h3>Creating the dynamic labels</h3>

In our example, <a href="http://yaccessibilityblog.com/examples/forms/dynamic-search-input.html">Dynamic form label with ARIA</a>, there is a select list for the email type and an input for the address. The first option has an id that is referenced by the text input's aria-labelledby attribute. 

As the user selects an option it is given an id and the email input receives this new id in the aria-labelledby attribute. The following video shows the interaction of the select and text inputs.

<iframe width="600" height="371" src="http://www.youtube.com/embed/Xr32OASZO_Q?rel=0&amp;hd=1" frameborder="0" allowfullscreen></iframe>

The HTML:
<div class="codesnip-container" ><div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">form</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">&quot;email-opts&quot;</span>&gt;</span><br />
&nbsp; &nbsp; Email: <br />
&nbsp; <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">label</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">select</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;email-opts&quot;</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;email-opts&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">option</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;email-opts-work&quot;</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;WORK&quot;</span>&gt;</span>Work Email<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">option</span>&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;PERSONAL&quot;</span>&gt;</span>Home Email<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">option</span>&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;Family&quot;</span> &gt;</span>Family Email<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">option</span>&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;Secret&quot;</span>&gt;</span>Secret Email<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">option</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">select</span>&gt;</span> <br />
&nbsp; <span class="sc2">&lt;<span class="kw2">input</span> aria-labelledby<span class="sy0">=</span><span class="st0">&quot;email-opts-work&quot;</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text&quot;</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;email&quot;</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;&quot;</span>&gt;</span><br />
<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">form</span>&gt;</span></div></div>

As the user selects an email type, the JavaScript adds an id to the selected option and changes the input's aria-labelledby value:
<div class="codesnip-container" ><div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">form</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">&quot;email-opts&quot;</span>&gt;</span><br />
&nbsp; &nbsp; Email: <br />
&nbsp; <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">label</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">select</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;email-opts&quot;</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;email-opts&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">option</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;email-opts-work&quot;</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;WORK&quot;</span>&gt;</span>Work Email<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">option</span>&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;PERSONAL&quot;</span>&gt;</span>Home Email<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">option</span>&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;Family&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;yui_3_3_0_1_131361980471217&quot;</span>&gt;</span>Family Email<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">option</span>&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;Secret&quot;</span>&gt;</span>Secret Email<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">option</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">select</span>&gt;</span> <br />
&nbsp; <span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text&quot;</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;&quot;</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;email&quot;</span> aria-labelledby<span class="sy0">=</span><span class="st0">&quot;yui_3_3_0_1_131361980471217&quot;</span>&gt;</span><br />
<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">form</span>&gt;</span></div></div>

<h3>The JavaScript solution</h3>

This form uses the <a href="http://yuilibrary.com">Yahoo! User Interface</a> (YUI) library to simplify this solution. YUI solves browser inconsistencies and provides built in functions for selecting DOM nodes, adding IDs, as well as changing attributes.  

The script starts by calling the base YUI 3.4 script. We then request the "node" and "event" functionality.  The setLabel function generates an id on the selected option and then sets that value on the input's aria-labelledby attribute.

The script also looks for an input with aria-labelledby and then associates it with the select item that precedes it. It then calls the setLabel function whenever an option is chosen.

<div class="codesnip-container" ><div class="javascript codesnip" style="font-family:monospace;"><span class="sy0">&lt;</span>script src<span class="sy0">=</span><span class="st0">&quot;http://yui.yahooapis.com/3.4.0/build/yui/yui-min.js&quot;</span> charset<span class="sy0">=</span><span class="st0">&quot;utf-8&quot;</span><span class="sy0">&gt;&lt;/</span>script<span class="sy0">&gt;</span><br />
<span class="sy0">&lt;</span>script type<span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span> charset<span class="sy0">=</span><span class="st0">&quot;utf-8&quot;</span><span class="sy0">&gt;</span><br />
YUI<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="kw2">use</span><span class="br0">&#40;</span><span class="st0">&quot;node&quot;</span><span class="sy0">,</span> <span class="st0">&quot;event&quot;</span><span class="sy0">,</span> <span class="kw2">function</span> <span class="br0">&#40;</span>Y<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
<br />
&nbsp; &nbsp; <span class="kw2">function</span> setLabel<span class="br0">&#40;</span>input<span class="sy0">,</span> select<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; input.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">&quot;aria-labelledby&quot;</span><span class="sy0">,</span> select.<span class="me1">all</span><span class="br0">&#40;</span><span class="st0">&quot;option&quot;</span><span class="br0">&#41;</span>.<span class="kw1">item</span><span class="br0">&#40;</span>select.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">&quot;selectedIndex&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>.<span class="me1">generateID</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; Y.<span class="me1">all</span><span class="br0">&#40;</span><span class="st0">&quot;input&quot;</span><span class="br0">&#41;</span>.<span class="me1">each</span><span class="br0">&#40;</span><span class="kw2">function</span> <span class="br0">&#40;</span>input<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> select<span class="sy0">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>select <span class="sy0">=</span> Y.<span class="me1">one</span><span class="br0">&#40;</span><span class="st0">&quot;#&quot;</span> <span class="sy0">+</span> input.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">&quot;aria-labelledby&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>.<span class="me1">ancestor</span><span class="br0">&#40;</span><span class="st0">&quot;select&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; select.<span class="me1">on</span><span class="br0">&#40;</span><span class="st0">&quot;change&quot;</span><span class="sy0">,</span> <span class="kw2">function</span> <span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setLabel<span class="br0">&#40;</span>input<span class="sy0">,</span> select<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<br />
<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="sy0">&lt;/</span>script<span class="sy0">&gt;</span></div></div>

<h4>JQuery variation</h4>

You can also use <a href="http://jquery.com/">jQuery</a>, although it will require a few modifications to the form.
<ol>
<li>Add an id to each of the options in the select (as jQuery doesn't have the cool generateID method)</li>
<li>Add a class "labelledbyselect" to the element that should be labelled to add flexibility (it can now also be any form input type i.e. a textarea)</li>
</ol>

The HTML
<div class="codesnip-container" ><div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">form</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">&quot;email-opts&quot;</span>&gt;</span><br />
&nbsp; &nbsp; Email: <br />
&nbsp; <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">label</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="kw2">select</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;email-opts&quot;</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;email-opts&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">option</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;email-opts-work&quot;</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;WORK&quot;</span>&gt;</span>Work Email<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">option</span>&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">option</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;email-opts-personal&quot;</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;PERSONAL&quot;</span>&gt;</span>Home Email<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">option</span>&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">option</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;email-opts-family&quot;</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;Family&quot;</span>&gt;</span>Family Email<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">option</span>&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">option</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;email-opts-secret&quot;</span> <span class="kw3">selected</span><span class="sy0">=</span><span class="st0">&quot;selected&quot;</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;Secret&quot;</span>&gt;</span>Secret Email<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">option</span>&gt;</span><br />
&nbsp; <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">select</span>&gt;</span> <br />
&nbsp; <span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;labelledbyselect&quot;</span> aria-labelledby<span class="sy0">=</span><span class="st0">&quot;email-opts-work&quot;</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;email&quot;</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text&quot;</span>&gt;</span><br />
<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">form</span>&gt;</span></div></div>

The jQuery JavaScript

<div class="codesnip-container" ><div class="javascript codesnip" style="font-family:monospace;"><span class="sy0">&lt;</span>script type<span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span> charset<span class="sy0">=</span><span class="st0">&quot;utf-8&quot;</span> src<span class="sy0">=</span><span class="st0">&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js&quot;</span><span class="sy0">&gt;</span><br />
<span class="sy0">&lt;/</span>script<span class="sy0">&gt;</span><br />
<span class="sy0">&lt;</span>script type<span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span> charset<span class="sy0">=</span><span class="st0">&quot;utf-8&quot;</span><span class="sy0">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jQuery<span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span>$<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">'.labelledbyselect'</span><span class="br0">&#41;</span>.<span class="me1">each</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> labelled <span class="sy0">=</span> $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; select <span class="sy0">=</span> $<span class="br0">&#40;</span><span class="st0">'#'</span> <span class="sy0">+</span> labelled.<span class="me1">attr</span><span class="br0">&#40;</span><span class="st0">&quot;aria-labelledby&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>.<span class="me1">parent</span><span class="br0">&#40;</span><span class="st0">'select'</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>select.<span class="me1">size</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; select.<span class="me1">change</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelled.<span class="me1">attr</span><span class="br0">&#40;</span><span class="st0">'aria-labelledby'</span><span class="sy0">,</span> select.<span class="me1">find</span><span class="br0">&#40;</span><span class="st0">'option:selected'</span><span class="br0">&#41;</span>.<span class="me1">attr</span><span class="br0">&#40;</span><span class="st0">'id'</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="sy0">&lt;/</span>script<span class="sy0">&gt;</span></div></div>

<h3>What you can do</h3>

This code can easily be extended. Perhaps you have a form where the user needs to enter multiple email address, phone numbers, and web sites. This example illustrates the usefulness of ARIA to do more than patch accessibility problems; ARIA  provides flexibility and dynamic connections.
<ul>
<li><a href="http://www.w3.org/TR/wai-aria/states_and_properties">ARIA supported states and properties</a></li>
<li><a href="/library/tag/aria">More about ARIA in the Yahoo! Accessibility Library</a></li>
<li><a href="http://yuilibrary.com/">YUI Library</a></li>
<li><a href="http://jquery.com/">jQuery</a></li>
</ul>

Credit: HTML/JavaScript examples by Todd Kloots (YUI), Dirk Ginader (jQuery)
]]></content:encoded>
			<wfw:commentRss>http://yaccessibilityblog.com/library/dynamic-form-labels-aria.html/feed</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>An Accessible Solution for Yahoo Search Direct</title>
		<link>http://yaccessibilityblog.com/library/accessible-solution-search.html</link>
		<comments>http://yaccessibilityblog.com/library/accessible-solution-search.html#comments</comments>
		<pubDate>Mon, 15 Aug 2011 16:00:26 +0000</pubDate>
		<dc:creator>Ted Drake</dc:creator>
				<category><![CDATA[Forms]]></category>
		<category><![CDATA[ARIA]]></category>
		<category><![CDATA[Autocomplete]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[live-region]]></category>
		<category><![CDATA[Yahoo!]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://yaccessibilityblog.com/library/?p=717</guid>
		<description><![CDATA[Caridy Patiño discusses how  you can create a dynamic and accessible search experience like the recently launched Yahoo! Search Direct]]></description>
			<content:encoded><![CDATA[<a href="http://search.yahoo.com/search?vs=yuiblog.com&p=Caridy+Pati%C3%B1o" title="read more articles by Caridy on the YUI Blog"><img src="http://yuiblog.com/assets/accessible-search-direct/caridy.jpg" width="150" alt="" class="alignright">Caridy Patiño</a>, the principal frontend engineer for Yahoo! Search Direct, just wrote an article for the Yahoo! User Interface blog on what went into creating an accessible, dynamic search box: <a href="http://www.yuiblog.com/blog/2011/08/08/making-search-direct-accessible/">Making Search Direct Accessible</a>.  

Caridy worked with Victor Tsaran, of the Yahoo! Accessibility Lab, to fine tune the experience of screen reader users typing a search query and being notified of potential results.
<span id="more-717"></span>
<img alt="Yahoo! Search Direct screen shot" src="http://yuiblog.com/assets/accessible-search-direct/sd.jpg" title=" " class="alignnone" width="600"  />

<blockquote>
<h3>Accessibility features</h3>

<p>In the quest for making Search Direct accessible, we looked at the implementation of Search Assistant, a technology that Yahoo! pioneered a few years back, as well as the native accessibility features of YUI.</p>

<p>After this investigation, three primary accessibility features were proposed for Search Direct:</p>

<ul>
    <li>Using the <a href="http://developer.yahoo.com/yui/3/intl/">YUI Internationalization utility</a> to serve localized content.</li>

    <li>Setting <b>role</b> and <b>aria-*</b> attributes on elements within the autocomplete widget, that need to be identified and processed by screen readers.</li>
    <li>Using a hidden <b>div</b> that represents a live region (<b>aria-live</b>) to notify the user when something happens. E.g., the number of available suggestions, the selected suggestion, etc.</li>

</ul>

<p>The plan was to notify the user of any changes in the Search Direct interface, and provide a set of keyboard shortcuts to navigate the following visual components:</p>

<ul>
    <li>Searchbox</li>
    <li>Submit button</li>
    <li>Suggestion list</li>
    <li>Rich panel</li>

<cite><a href="http://www.yuiblog.com/blog/2011/08/08/making-search-direct-accessible/">Making Search Direct Accessible</a></cite>
</blockquote>

Read the complete article to find out how they approached the best user experience solutions and how it was programmed.
]]></content:encoded>
			<wfw:commentRss>http://yaccessibilityblog.com/library/accessible-solution-search.html/feed</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
	</channel>
</rss>

