<?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>Accessibility Tips &#187; markup</title>
	<atom:link href="http://accessibilitytips.com/tag/markup/feed/" rel="self" type="application/rss+xml" />
	<link>http://accessibilitytips.com</link>
	<description>A collection of tips, guidance and practical suggestions in developing accessible websites</description>
	<lastBuildDate>Sat, 02 May 2009 05:07:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Using fieldsets outside of forms</title>
		<link>http://accessibilitytips.com/2009/04/30/using-fieldsets-outside-of-forms/</link>
		<comments>http://accessibilitytips.com/2009/04/30/using-fieldsets-outside-of-forms/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 04:59:07 +0000</pubDate>
		<dc:creator>Isofarro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[buttons]]></category>
		<category><![CDATA[fieldsets]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[interactive]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[legend]]></category>
		<category><![CDATA[markup]]></category>
		<category><![CDATA[progressive enhancement]]></category>
		<category><![CDATA[rich media]]></category>
		<category><![CDATA[screenreaders]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://accessibilitytips.com/?p=27</guid>
		<description><![CDATA[The focus on using the most appropriate markup in JavaScript enhanced pages has raised an interesting problem about the use of form elements outside of a form. And using a fieldset to group these elements together is proving to be a very useful way of making them accessible. Using form elements outside of a form [...]]]></description>
			<content:encoded><![CDATA[<p>The focus on using the most appropriate markup in JavaScript enhanced pages has raised an interesting problem about the use of form elements outside of a <code>form</code>. And using a <code>fieldset</code> to group these elements together is proving to be a very useful way of making them accessible.</p>
<h3>Using form elements outside of a form</h3>
<p>Why would form elements appear outside of a <code>form</code>? Our typical use-case is an image carousel. In bare plain markup this is nothing more than an list of linked image elements. When we introduce JavaScript we can turn this plain list into an animated photo-gallery. A carousel of images a visitor can either let auto-scroll, or offer the visitor the option of manually scrolling through the images.</p>
<h3>The practical use of image carousels</h3>
<p>One particularly elegant use of scrollable image carousels is Flickr&#8217;s picture sorting tool. It allows a visitor to sort his uploaded photographs into sets and then annotate them either individually or in groups. The image carousel is a powerful metaphor for navigating through potentially thousands of images. </p>
<p>Another top notch demonstration of an image carousel is Apple&#8217;s Coverflow implementation which first surfaced as a means of scanning album covers in it&#8217;s much regarded iTunes media application.</p>
<h3>Using the appropriate markup</h3>
<p>It is clear we need buttons for navigating forwards and backwards through our list of images. Many developers use anchor links styled to emulate buttons, but a better method is to use a <code>button</code> element. The <code>button</code> element offers all the functionality of the simple link, plus you get the default button states for free. So semantically, a <code>button</code> element is the appropriate element to use as a button.</p>
<h3>Is it valid?</h3>
<p>The immediate retort I hear is that form elements only belong inside a <code>form</code>, because otherwise it isn&#8217;t valid HTML. Surprisingly, the HTML 4.01 Strict Recommendation doesn&#8217;t impose this limitation at all. Form elements are not limited to being children of a <code>form</code>. The <abbr title="Document Type Definition">DTD</abbr> also doesn&#8217;t impose this limitation, and an English translation of it goes something like this:</p>
<blockquote cite="http://www.w3.org/TR/REC-html40/sgml/dtd.html">
<p>All input related-elements (<code>input</code>, <code>select</code>, <code>textarea</code>, <code>label</code>, <code>button</code>) belong to a group called &#8216;Form Controls&#8217;. The Form Control group is just a subset of inline elements.</p>
<p>This means that anywhere an inline element can validly go, so too can a form control element.</p>
<p>There are some exceptions, for example you can&#8217;t place a form control inside of a <code>button</code> element.</p>
</blockquote>
<p>What is even more surprising is that the <code>fieldset</code> element also doesn&#8217;t have to be inside a <code>form</code>.</p>
<p>I suspect that allowing form elements and fieldsets to exist validly outside of a form isn&#8217;t an error by the HTML Working Group, but a particularly insightful forward thinking about the various alternate uses of these form input elements.</p>
<h3>Multiple video-player like widgets</h3>
<p>Many rich media pages on the web contain not just one single image carousel, but sometimes more than one. They also can contain similar enhanced widgets like video players, audio players, animation. </p>
<p>HTML5&#8242;s Canvas will probably be used as a means of visualising realtime data, like showing the spread of &#8220;swine flu&#8221; across the globe over time (with time annotated text-equivalents). It would be immensely useful to be able to move forward and backward through time and understand how the infection spreads at each time point. We would need buttons to allow a visitor to do that.</p>
<h3>Multiple remote controls</h3>
<p>We quickly land in a situation where we may have more than one set of video-player controls, each one controlling a different widget or collection of content. (Much like every living room having multiple remote controls, and it&#8217;s a perennial game to remember which remote controls which device).</p>
<p>On the web we run into a two fold problem for screen reader users in particular:</p>
<ul>
<li>It is difficult to determine which set of video player controls controls which group of content. Being adjacent to the actual content is sometimes not sufficient</li>
<li>In forms mode these buttons are perceivable to the visitor, and without the surrounding context it is difficult to understand the purpose of these buttons.</li>
</ul>
<h3>The forms mode issue</h3>
<p>It could be argued that buttons outside of forms should not be accessible in forms mode, but I find that argument has little merit because the buttons on the page still have a purpose to the user, and that equivalent should still be available to the screenreader user.</p>
<p>Otherwise we are not providing an equivalent experience. The interaction with video-player like controls doesn&#8217;t automatically mean that the output is visual only. We must not make that mistake.</p>
<h3>Grouping <code>button</code>s by <code>fieldset</code>s</h3>
<p>To improve the accessibility of groups of buttons we wrap each group of <code>button</code>s in its own <code>fieldset</code>. And every <code>fieldset</code> has to have a <code>legend</code> element that provides a succinct and short description of the collection of buttons.</p>
<h3>Carefully chosen <code>legend</code></h3>
<p>The <code>legend</code> text must be carefully thought out. It must be long enough to remove doubt about the purpose of the set of buttons that follow, but short enough for it not to be frustrating when prefixed before the description of every button.</p>
<h3>Dynamic <code>legend</code> text</h3>
<p>But at this point, the <code>button</code>s only make sense in a JavaScript context because the behaviour depends on JavaScript being available. Which means those buttons should added to the page by JavaScript, and consequently we can do the same for the <code>legend</code> and <code>fieldset</code> elements.</p>
<p>This adds another dimension to the <code>legend</code> text; it can be altered on the fly by JavaScript through a corresponding set of JavaScript events.</p>
<p>For example, when the visitor first focuses on an element inside of a <code>fieldset</code>, the default <code>legend</code> text can be an appropriate description of the purpose of these <code>button</code> controls. As the visitor then interacts with the <code>button</code>s the <code>legend</code> can be updated on the fly to present more pertinent information, like the date of the currently displayed epidemic growth map, or some state information like the user is seeing the <samp>first four pictures of twenty</samp>.</p>
<h3>Building on previous ideas</h3>
<p><a href="http://blog.ginader.de/">Dirk Ginader</a> used this technique of updating <code>legend</code> text on the fly very successfully in Yahoo Finance&#8217;s <a href="http://developer.yahoo.net/blog/archives/2009/01/accessible_converter.html">accessible currency converter</a>.</p>
<h3>Acknowledgements</h3>
<p>Once again, as with so many other fine accessibility innovations at Yahoo, the credit and initial idea of using <code>fieldset</code>s in this way was suggested by fellow Yahoo colleague, <a  href="http://twitter.com/DesignedByBlind">Artur Ortega</a>, one of the real practical experts in web accessibility. He is a fertile source of excellent and creative ideas of improving the accessibility of interactive and rich media components. A true gem of an engineer.</p>
]]></content:encoded>
			<wfw:commentRss>http://accessibilitytips.com/2009/04/30/using-fieldsets-outside-of-forms/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

