<?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>Tudor Barbu&#039;s professional blog &#187; standards</title>
	<atom:link href="http://blog.motane.lu/tag/standards/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.motane.lu</link>
	<description>Ramblings about software development</description>
	<lastBuildDate>Thu, 02 Feb 2012 17:38:27 +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>Target blank links</title>
		<link>http://blog.motane.lu/2009/02/09/target-blank-links/</link>
		<comments>http://blog.motane.lu/2009/02/09/target-blank-links/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 21:05:49 +0000</pubDate>
		<dc:creator>Tudor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[standards]]></category>
		<category><![CDATA[w3c]]></category>

		<guid isPermaLink="false">http://blog.motane.lu/?p=270</guid>
		<description><![CDATA[One never ending debate on the web is on whether external links should open in new windows. Some say Yes! they should open in new windows because we need to keep the users on our site as long as possible. Usually these are the sales/marketing people. The other group says No! They shouldn&#8217;t open in [...]]]></description>
			<content:encoded><![CDATA[<p>One never ending debate on the web is on whether external links should open in new windows. Some say <q>Yes! they should open in new windows because we need to keep the users on our site as long as possible.</q> Usually these are the sales/marketing people. The other group says <q>No! They shouldn&#8217;t open in new windows, because they&#8217;re extremely annoying and we should always let the user decide</q>. These are the programmers, the group I&#8217;m in. </p>
<p>There&#8217;s also a third player in the debate, the World Wide Web Consortium. According to the XHTML Strict specifications, the usage of the target attribute has been banned. This happens because the XHTML Strict standard focuses entirely on the content of the document while sending all the presentation data to the stylesheet. The target attribute is a presentational one, because it specifies how the data from the hypertext reference should be presented to the user (in a new window, in a frame and so on). The XHTML Strict standard is meant to be used with all kinds of user agents &#8211; not just browsers &#8211; even with those that don&#8217;t support data presentation in the traditional way, in a browser&#8217;s window. This category of user agents includes, but is not limited to, screen readers for visually impaired persons, text-based browser such as links, web crawlers and so on. How could a text-based browser open a link in a new window? It doesn&#8217;t even have the &#8220;new window&#8221; concept.<span id="more-270"></span></p>
<h2><span>Javascript to the rescue</span></h2>
<p>If you want a well formatted XHTML document with <code>target="_blank"</code> links, go for the Transitional doctype. If you&#8217;re stubborn and want to use the Strict doctype, simply mark all external links with a special class, let&#8217;s say &#8220;outgoing&#8221;. If a link has this class than it should open in a new window. A good idea is to use this class in your CSS file and mark all external links with an easy to spot icon, just like Wikipedia does. It&#8217;s very user friendly. After all the links in the document are marked this way, simply use one of the javascript snippets below &#8211; depending on which framework you use &#8211; to make them open in a new window. </p>
<p>First the prototype version&#8230;</p>
<pre class="brush: jscript; title: ; notranslate">
Event.observe(
    window,
    'load',
    function() {
        $$( 'outgoing' ).each(
            function( item ) {
                item.target = '_blank';
            }
        );
    },
    true
);
</pre>
<p>&#8230;and now the jQuery version&#8230;</p>
<pre class="brush: jscript; title: ; notranslate">
$( function() {
        $( '.outgoing' ).each(
            function() {
                this.target = '_blank';
            }
        );
    }
);
</pre>
<p>Isn&#8217;t this just cheating the standard? Well&#8230;ummm&#8230;kind of. But it keeps everybody happy. Because if the target attribute is not supported by the user agent &#8211; not a GUI browser &#8211; it will still receive the well formatted XHTML document and will be able to parse it and use the information within without breaking a sweat. And if the user agent does support the target attribute &#8211; usually this means that it&#8217;s a GUI based web browser &#8211; then all the links will pop up in new, extremely annoying, windows and the folks in the sales department will be very, very happy.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.motane.lu/2009/02/09/target-blank-links/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Labels and accessibility</title>
		<link>http://blog.motane.lu/2008/12/20/labels-and-accessibility/</link>
		<comments>http://blog.motane.lu/2008/12/20/labels-and-accessibility/#comments</comments>
		<pubDate>Sat, 20 Dec 2008 22:50:31 +0000</pubDate>
		<dc:creator>Tudor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[accesibility]]></category>
		<category><![CDATA[standards]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://blog.motane.lu/?p=31</guid>
		<description><![CDATA[Some time ago, I&#8217;ve stumbled upon some specifications about the proper use of the label tag on webpages. And it seems that labels are a must if you want to make your page accessible to people with disabilities or if you just want to pass the Cynthia says validation and brag about it. Proper use [...]]]></description>
			<content:encoded><![CDATA[<p>Some time ago, I&#8217;ve stumbled upon some specifications about the proper use of the label tag on webpages. And it seems that labels are a must if you want to make your page accessible to people with disabilities or if you just want to pass the <a class="outgoing" title="Cynthia Says Portal" href="http://www.contentquality.com/">Cynthia says</a> validation and brag about it.<span id="more-31"></span></p>
<h2><span>Proper use of labels</span></h2>
<p>You can assign labels to text inputs or textareas by specifying the &#8220;for&#8221; attribute. Like so:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;label for=&quot;username&quot;&gt;Enter your username&lt;/label&gt;
&lt;input type=&quot;text&quot; name=&quot;username&quot; id=&quot;username&quot;&gt;
</pre>
<p>This will help screen readers and other software designed to help impaired people surf the web to correctly interpret your code and make the right associations between labels and textfields. For instance, the following piece of code displays a table row with some form tags in it:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;tr&gt;
	&lt;td&gt;
		Enter your username
	&lt;/td&gt;
	&lt;td&gt;
		&lt;input type=&quot;text&quot; name=&quot;username&quot; id=&quot;username&quot; /&gt;
	&lt;/td&gt;
&lt;/tr&gt;
</pre>
<p>For a normal visitor, this is very simple to understand because the &#8220;Enter your username&#8221; text and the username textfield are on the same line. But for a blind person that uses a screen reader, this will not be displayed at all. And the screen reader must decide witch text goes with what textfield.</p>
<p>On this example, I believe that most screen readers will make the right connection between text and textfield, but if the html code becomes a little more complicated (ie. more text or other tags) I sure that the screen reader will fail to make the right assumptions. But the use of labels can fix that.</p>
<h2><span>Label&#8217;s accesskey</span></h2>
<p>If you want to give your forms a cool &#8220;web2.0 style&#8221; functionality, you can specify the accesskey attribute for your labels. For example you can do something like:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;label for=&quot;username&quot; accesskey=&quot;u&quot;&gt;Enter your &lt;strong&gt;u&lt;/strong&gt;sername&lt;/label&gt;
&lt;input type=&quot;text&quot; name=&quot;username&quot; id=&quot;username&quot; /&gt;
</pre>
<p>&#8230;and when the user presses CTRL/ALT + u (depending on the browser) he&#8217;ll be taken directly to that textfield. Pretty neat.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.motane.lu/2008/12/20/labels-and-accessibility/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

