<?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>Substance Labs &#187; Accessibility</title>
	<atom:link href="http://labs.findsubstance.com/category/accessibility/feed/" rel="self" type="application/rss+xml" />
	<link>http://labs.findsubstance.com</link>
	<description>Create. Constantly.</description>
	<lastBuildDate>Wed, 27 Jul 2011 18:18:57 +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>Fixing the flash of no-JavaScript styles</title>
		<link>http://labs.findsubstance.com/2011/05/24/fixing-the-flash-of-no-javascript-styles/</link>
		<comments>http://labs.findsubstance.com/2011/05/24/fixing-the-flash-of-no-javascript-styles/#comments</comments>
		<pubDate>Tue, 24 May 2011 16:54:21 +0000</pubDate>
		<dc:creator>Cory Duncan</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://labs.findsubstance.com/?p=377</guid>
		<description><![CDATA[The flash of no-JavaScript styles (FONJS) happens when styles need to be applied to certain elements, but only if JavaScript is enabled. If the JavaScript doesn&#8217;t execute fast enough, the user may briefly see the no-JavaScript styles. An example of where FONJS can occur is a tab interface, which consists of a list of navigation [...]]]></description>
			<content:encoded><![CDATA[<p>The flash of no-JavaScript styles (FONJS) happens when styles need to be applied to certain elements, but only if JavaScript is enabled. If the JavaScript doesn&#8217;t execute fast enough, the user may briefly see the no-JavaScript styles.</p>
<p>An example of where FONJS can occur is a tab interface, which consists of a list of navigation links (tabs) and the content they will activate (tab content). To consider the audience that may have JavaScript turned off or unavailable (for any number of reasons), we want the tab content to be accessible without JavaScript. When JavaScript is available, all tab content should be hidden, except for the active one. Conversely, when it&#8217;s not available, all tab content should be visible.</p>
<pre><code>&lt;style&gt;
.js .tab-content {
	display: none;
	}
&lt;/style&gt;
&lt;ul class="tabs"&gt;
	&lt;li&gt;&lt;a href="#tab-content1"&gt;Tab 1&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="#tab-content2"&gt;Tab 2&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="tab-content" id="tab-content1"&gt;
	Tab content 1
&lt;/div&gt;
&lt;div class="tab-content" id="tab-content2"&gt;
	Tab content 2
&lt;/div&gt;</code></pre>
<h2>Implementing a solution</h2>
<h3>Option 1: <code>.js</code> class</h3>
<p>This option is based on the idea that a <code>.js</code> class will be added to the <code>&lt;html&gt;</code> element via JavaScript to craft styles that depend on JavaScript. FONJS is frequently observed when a JavaScript library (like <a href="http://jquery.com">jQuery</a>) is used to apply the <code>.js</code> class, and particularly when that library is loaded at the end of the document. For <a href="http://developer.yahoo.com/performance/rules.html#js_bottom">performance</a> <a href="http://www.stevesouders.com/blog/2010/09/30/render-first-js-second/">reasons</a>, we do want to load external scripts at the end of the document.</p>
<p>We need a fast, library-agnostic way of doing this, that will also maintain any existing classes on the <code>&lt;html&gt;</code> element. To ensure the JavaScript will execute quickly enough, it needs to be embedded in the <code>&lt;head&gt;</code> block. </p>
<pre><code>&lt;script&gt;
document.documentElement.className = document.documentElement.className + ' js';
&lt;/script&gt;</code></pre>
<p>Note: <code>document.documentElement</code> returns the root element of the document. In the case of an HTML document, this should always return the <code>&lt;html&gt;</code> element.</p>
<h3>Option 2: <code>&lt;noscript&gt;</code></h3>
<p>The purer option of the two, and my preference, this solution simply uses a <code>&lt;noscript&gt;</code> element in the <code>&lt;head&gt;</code> block to load an external stylesheet used for no-JavaScript styles.</p>
<pre><code>&lt;noscript&gt;
	&lt;link href="/css/no-js.css" rel="stylesheet" /&gt;
&lt;/noscript&gt;</code></pre>
<h3>Option ?</h3>
<p>As with many things in web development, there are several solutions to this problem. I&#8217;ve documented the two approaches that I&#8217;m familiar with. If you have a different solution to this problem, please share in the comments area.</p>
]]></content:encoded>
			<wfw:commentRss>http://labs.findsubstance.com/2011/05/24/fixing-the-flash-of-no-javascript-styles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t lose your :focus</title>
		<link>http://labs.findsubstance.com/2009/09/15/dont-lose-your-focus/</link>
		<comments>http://labs.findsubstance.com/2009/09/15/dont-lose-your-focus/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 23:21:41 +0000</pubDate>
		<dc:creator>Cory Duncan</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://labs.findsubstance.com/?p=202</guid>
		<description><![CDATA[CSS resets are great. Without them, our jobs as UI developers would be much more frustrating, or at the least, more tedious. They give us a (mostly) level playing field when building user interfaces that work across multiple browsers. My personal favorite, and probably the most-used reset stylesheet, is the one Eric Meyer has built [...]]]></description>
			<content:encoded><![CDATA[<p><abbr title="Cascading Style Sheets">CSS</abbr> resets are great. Without them, our jobs as <abbr title="User Interface">UI</abbr> developers would be much more frustrating, or at the least, more tedious. They give us a (mostly) level playing field when building user interfaces that work across multiple browsers. My personal favorite, and probably the most-used reset stylesheet, is the one Eric Meyer has <a href="http://meyerweb.com/eric/thoughts/2007/04/18/reset-reasoning/">built</a> and <a href="http://meyerweb.com/eric/tools/css/reset/">maintained</a>. It works great and has <a href="http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/">solid</a> <a href="http://meyerweb.com/eric/thoughts/2008/01/15/resetting-again/">reasoning</a> behind it.</p>
<p>What does this have to do with the focus state? Part of the reset includes resetting the focus state style.</p>
<pre><code>/* remember to define focus styles! */
:focus {
	outline: 0;
}
</code></pre>
<p>Note the comment there&#8230;</p>
<p>Resetting the focus state is fine, I&#8217;d encourage it in fact &#8212; the default browser focus state is ugly! Here&#8217;s an example of what the default focus state for Firefox (3.5 Mac) looks like:</p>
<p><img src="http://labs.findsubstance.com/wp-content/uploads/2009/09/default-focus-state.png" alt="" width="47" height="35" /></p>
<p>Even though Eric explicitly states in his reset CSS to define a focus style, in my experience this step is often neglected. Without a focus style defined, using the keyboard as a navigation device becomes a more difficult task. Keyboard navigation may be an edge case, but a focus state should always be considered. </p>
<p>The simplest solution is to extend the hover style:</p>
<pre><code>a:hover, a:focus {
	color: #666;
	}</code></pre>
<p>With one extra selector, we&#8217;ve made the interface more accessible to keyboard navigation. For more complex interfaces with varying hover styles, you may need to declare more than one focus style, but that&#8217;s a small price to pay for accessibility.</p>
]]></content:encoded>
			<wfw:commentRss>http://labs.findsubstance.com/2009/09/15/dont-lose-your-focus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

