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

<channel>
	<title>Better Testing</title>
	<atom:link href="http://www.bettertesting.co.uk/content/?feed=rss2" rel="self" type="application/rss+xml"/>
	<link>https://www.bettertesting.co.uk/content</link>
	<description>Thoughts, insights and ideas on Software Testing from Darren McMillan.</description>
	<lastBuildDate>Tue, 20 Oct 2020 10:30:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Accessibility considerations: Hidden content and the accessibility tree</title>
		<link>https://www.bettertesting.co.uk/content/?p=1672</link>
		<comments>https://www.bettertesting.co.uk/content/?p=1672#comments</comments>
		<pubDate>Wed, 05 Dec 2012 23:23:47 +0000</pubDate>
		<dc:creator>Darren McMillan</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[learning]]></category>

		<guid isPermaLink="false">http://www.bettertesting.co.uk/content/?p=1672</guid>
		<description><![CDATA[Overview Often when developing a web page, it can make sense to hide specific aspects of the page until a certain action occurs, which causes them to appear. A common...]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><h2>Overview</h2>
<p>Often when developing a web page, it can make sense to hide specific aspects of the page until a certain action occurs, which causes them to appear.  A common example of this is navigation menus, which when navigated to sometimes display child items of the navigation menu in a list.  The child elements of the navigation menu are often styled using CSS to be hidden by default, then shown when interacted with by using Javascript.  Basic stuff, right?  In the following post I’d like to explain the common pitfalls with hidden content and how it interacts with the accessibility tree.  No idea what the accessibility tree is?  Don’t worry, we’ll cover that too.</p>
<h2>The Document Object Model and the Accessibility Tree</h2>
<p>The Document Object Model (DOM) is what it says on the tin, a method to gather up information processed in the page source, and provide it in an object model, which can be interacted with and programmatically manipulated.  For example, one of the most used commands in Javascript is <code>document.getElementById</code> which directly accesses the DOM to allow the user to reference an element, and with further logic be able to manipulate its attributes, styling and more.</p>
<p>The Accessibility Tree is a subset of the DOM, that mirrors each element included in the DOM, but strips out the unneeded parts which wouldn’t be beneficial for assistive technologies.  In short, this is what is presented to assistive technologies who want to digest and interact with a web page.</p>
<p>It is important to understand that how each browser builds its DOM and Accessibility Tree will be different.  Also their support for newer markup such as HTML5 and WAI-ARIA might be limited.  That is why it is important to test what you plan to implement with various browsers and assistive tech.</p>
<p>Understanding the DOM and Accessibility Tree doesn’t really matter, but being able to identify why something may, or may not be picked by assistive tech does.</p>
<h3>Hiding content from the Accessibility Tree with CSS</h3>
<p>Using CSS we can hide an element from the page using either <code>display: none;</code>, or <code>visibility: hidden;</code>.</p>
<p>Although other methods of hiding elements with CSS exist, both of the above CSS properties are most commonly used.  They have one common problem: both are completely ignored by assistive technologies!  Now the fact that they are ignored is not a bad thing, but it does lead to misuse, which in turn creates accessibility problems.</p>
<p>So let’s look at some examples of where it could go wrong.</p>
<h4>Hidden form labels</h4>
<p><a href="http://www.jdsports.co.uk/home" target="_blank">JD Sports</a> have many flaws with their website, but let’s only consider their search field for now.</p>
<p style="text-align: center;"><a href="http://www.bettertesting.co.uk/content/wp-content/uploads/2012/12/jdsports2.png"><img style="margin-bottom: 4px;" src="http://www.bettertesting.co.uk/content/wp-content/uploads/2012/12/jdsports2.png" alt="Labelless input field example." width="620" height="90" /></a><br />
<span style="font-size: x-small;">Example of a labelless search input field, used on the JD Sports website.</span></p>
<p>Labelless search fields are quite common these days.  They can impact accessibility in a few ways, but let’s just consider one: a field without a label.  Now for assistive technology this creates a problem as the field will make no sense. For most it will simply be interpreted as an edit field.  So to counter this we would add a label for the input field, to explain its purpose to assistive technology.</p>
<p>For purely the label aspect JD Sports do a couple of things wrong:</p>
<p>1. They correctly create a label for the input field, but don’t relate it to the field by using the <a href="http://www.w3schools.com/tags/att_label_for.asp" target="_blank">label for attribute</a>.</p>
<p><span style="text-decoration: underline;">Incorrect:</span></p>
<pre class="brush: xml; title: ; notranslate">&lt;label&gt;Search site&lt;/label&gt;</pre>
<p><span style="text-decoration: underline;">Correct:</span></p>
<pre class="brush: xml; title: ; notranslate">&lt;label for=&quot;ID&quot;&gt;Search site&lt;/label&gt;</pre>
<p>2. The input field for the search field also doesn’t have an ID attribute to map the label for to.</p>
<p><span style="text-decoration: underline;">Incorrect:</span></p>
<pre class="brush: xml; title: ; notranslate">&lt;input name=&quot;freeText&quot; type=&quot;text&quot; /&gt;</pre>
<p><span style="text-decoration: underline;">Correct:</span></p>
<pre class="brush: xml; title: ; notranslate">&lt;input id=&quot;search&quot; name=&quot;freeText&quot; type=&quot;text&quot; /&gt;</pre>
<p>3.  The final nail in the coffin though, and the one that we care about most in the context of this discussion, is their use of <code>display: none</code> on the search label.</p>
<p>I see this a lot!  It drives me nutz, because knowingly, or not it defeats the purpose of the accessibility feature they have attempted to add.  Of course though, not everyone understands that <code>display: none;</code>, or <code>visibility: hidden;</code> are ignored by assistive tech.  In the case of JD Sports though, however had built their site is clearly a bit of a cowboy, who doesn’t really know what they’re doing.</p>
<p>So if you can’t hide it with display: none, or visibility: hidden then what do you do?</p>
<h4>Display accessible content off screen</h4>
<p>Well you can of course display it off screen, so that it is visually hidden, but can still be picked up by assistive tech.  So in the case of JD Sports it would be something like so:</p>
<p><strong>HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">&lt;label class=&quot;hidden&quot; for=&quot;search&quot;&gt;Search site&lt;/label&gt;</pre>
<p><strong>CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
.hidden {
position:absolute;
left:-10000px;}</pre>
<p>Now this is my prefered method, but as Jonathan Snook correctly points out in his article <a href="http://snook.ca/archives/html_and_css/hiding-content-for-accessibility" target="_blank">hiding content for accessibility</a>, this won’t work cosmetically for right to left languages.  If you don’t have to concern yourself with RTL languages, then don’t worry.  Otherwise use his suggested solution below:</p>
<p><strong>CSS</strong></p>
<pre class="brush: css; title: ; notranslate">.hidden {
position: absolute !important;
height: 1px; width: 1px;
overflow: hidden;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
}</pre>
<h4>Hidden navigation menus</h4>
<p>Ok simple stuff, right?  So what if we go for something a little bigger, like a navigation menu?</p>
<p>On the <a href="http://www.poundland.co.uk/" target="_blank">Poundland website</a>, and countless others, they use <code>display:none;</code> to hide the contents of the drop down navigation menus until they are selected.  Makes sense you would think.  Let’s also assume that your dropdown navigation menu is keyboard accessible. It would still make sense, because when the user focuses on the top level navigation item, the child elements we assume will become unhidden?  Wrong!  We can’t predict that all users will interact with a web page in the same way.  Keyboard navigation may be one choice &#8211; another option though might be to scan the page line by line with assistive tech, or use keyboard shortcuts to get where you want in a document before scanning its contents.  This scenario wouldn’t work, as the child navigation items would be hidden from assistive techs view, so they would only pick up on the top level navigation items, not the hidden contents.</p>
<p style="text-align: center;"><a href="http://www.bettertesting.co.uk/content/wp-content/uploads/2012/12/poundland-menu.png"><img style="margin-bottom: 4px;" src="http://www.bettertesting.co.uk/content/wp-content/uploads/2012/12/poundland-menu.png" alt="Poundland main navigation menu example." width="620" height="280" /></a><br />
<span style="font-size: x-small;">Example of Poundland hiding content from users of assistive tech, with <em>display:none;</em>.</span></p>
<p>Again an off left technique would work fine here, which can be toggled using JavaScript to appear back on screen when in focus.  The rule of thumb for elements which can be navigated to using the tab key, is to bring them back on screen when focused upon.</p>
<p>There are some scenarios where you may genuinely require an offscreen navigation element which would never appear on screen when in focus.  The BBC for example use an accessible skip link, for users to skip the navigation and go straight to content.  Their implementation jumps to an off screen navigation link, which is excluded from normal keyboard navigation by setting the elements <code>tabindex</code> attribute to <code>-1</code> (exclude from tab order), but still focusable by setting <a href="http://api.jquery.com/focus/" target="_blank">focus</a> using JavaScript.</p>
<h4>SEO and CSS off screen techniques</h4>
<p>Now hiding content off screen for accessibility purposes is all good, but couldn’t that be abused to improve search engine rankings?  Of course it could, but thankfully search engines are clever enough to know when someone is abusing this or not.  Keyword spamming off screen might downgrade your ranking, and if bad enough remove you from search listings altogether, but providing accessible information and links will not.</p>
<p>Google Webmaster Tools, have an article explaining this in their help sections, titled: <a href="http://support.google.com/webmasters/bin/answer.py?hl=en&amp;answer=66353" target="_blank">Hidden text and links</a>.</p>
<h4>Putting <code>display: none;</code>, or <code>visibility:hidden;</code> to good use</h4>
<p>So when does it make sense to use <code>display: none;</code>, or <code>visibility: hidden;</code>?</p>
<p>Well most sites in the UK now have a cookie policy message which appears the first time you visit a website.  This is now a legal obligation which sites have to make you aware of, they don’t require you to accept it, they just need to present it to you on your first visit.</p>
<p>The <a href="http://home.scotland.gov.uk" target="_blank">Scottish Government</a> has an odd example which admittedly isn’t fully accessible in its current implementation, but makes a good use case for using <code>display:none;</code> (and it does).</p>
<p style="text-align: center;"><a href="http://www.bettertesting.co.uk/content/wp-content/uploads/2012/12/scottishgov.png"><img style="margin-bottom: 4px;" src="http://www.bettertesting.co.uk/content/wp-content/uploads/2012/12/scottishgov.png" alt="Scottish goverment website example of using display:none." width="620" height="165" /></a><br />
<span style="font-size: x-small;">Scottish goverment website example of using <em>display:none;</em>.</span></p>
<p>After you have seen this cookie policy once, you’ll not need to see it again.  Likewise for assistive tech, if you’ve read it once, you can effectively ignore it.  Making use of <code>display:none;</code> here to hide the entire element that contains the cookie policy, allows assistive tech to effectively never process it again.  Next time you visit the site, the div (element) that contains the cookies policy popup will be hidden using <code>display:none;</code>.  This means that users of assistive tech do not need to process it again.  If they styled it to appear off screen like we’d suggested for the previous examples, then visually normal users wouldn’t have seen it, but assistive tech would have still picked up on it.</p>
<p class="main-caption">Play around with the Scottish Government example and see if you can spot their accessibility mistakes with this cookie control.  There is also a blatant lie in regards to cookies.  See if you can spot it.  No prizes, but I’m keen to see if anyone can spot the mistakes.  Using what you’ve learned so far you should be able to.</p>
<p>A checkout process might be another example of when it might make sense to use <code>display: none;</code>.   You might require data to be entered into the current step, before being able to progress to the next.  So if you didn’t use <code>display:none;</code> here, then you might confuse users of assistive tech who would be able to read steps that visual users can’t, for good reason.</p>
<h4>Other problematic CSS</h4>
<p><a href="http://www.apple.com/accessibility/voiceover/" target="_blank">VoiceOver</a> by Apple has accessibility issues when an element&#8217;s height or width is set to zero.  An element with this style applied will be ignored.  Enrique Palazzo as far as I can tell was the first person to identify this issue on a <a href="http://drupal.org/node/718922#comment-2734198" target="_blank">Drupal issue ticket</a>.</p>
<p><a href="http://www.kent.gov.uk/" target="_blank">Kent County Council</a> at the time of writing introduce this issue for VoiceOver users on their off screen skip links.</p>
<p style="text-align: center;"><a href="http://www.bettertesting.co.uk/content/wp-content/uploads/2012/12/kentcouncil.png"><img style="margin-bottom: 4px;" src="http://www.bettertesting.co.uk/content/wp-content/uploads/2012/12/kentcouncil.png" alt="Example of the Kent council website impacting Voiceover users." width="620" height="280" /></a><br />
<span style="font-size: x-small;">Example of Kent councils websites, impacting Voiceover users, with a height and width of zero.</span></p>
<p>It is easily fixed though by increasing the width and height to 1px.</p>
<p>While we are on the topic of faulty skip links, the UK Government&#8217;s <a href="http://digital.cabinetoffice.gov.uk/about/" target="_blank">Digital Service website</a> hide their skip link with <code>display:none;</code>.  Interesting when it is supposed to be a pioneer for government digital content.</p>
<p style="text-align: center;"><a href="http://www.bettertesting.co.uk/content/wp-content/uploads/2012/12/gds.png"><img style="margin-bottom: 4px;" src="http://www.bettertesting.co.uk/content/wp-content/uploads/2012/12/gds.png" alt="Skip link example hidden using display:none." width="620" height="240" /></a><br />
<span style="font-size: x-small;">Example of the UK goverments Digital Service website, hiding their skip link with <em>display:none;</em>.</span></p>
<p>So using CSS to hide elements from the page isn’t a terrible thing to do in regards to accessibility.  The main problem is the misuse of it, and being able to understand when it should, or shouldn’t be used.</p>
<h3>Problematic JavaScript</h3>
<p>Everybody and their mom these days uses <a href="http://jquery.com/" target="_blank">JQuery</a>.  Why?  Well it’s a lot simpler to do things in JQuery than it is in JavaScript.</p>
<p>JQuery has a lot of methods that present accessibility issues if misused:</p>
<p><a href="http://api.jquery.com/hide/" target="_blank">.hide()</a><br />
<a href="http://api.jquery.com/fadeOut/" target="_blank">.fadeOut()</a><br />
<a href="http://api.jquery.com/fadeToggle/" target="_blank">.fadeToggle()</a><br />
<a href="http://api.jquery.com/slideToggle/" target="_blank">.slideToggle()</a><br />
<a href="http://api.jquery.com/slideUp/" target="_blank">.slideUp()</a><br />
<a href="http://api.jquery.com/toggle/" target="_blank">.toggle()</a></p>
<p>Each of these adds <code>display:none;</code> inline to the element, which depending upon the context of its usage, could present accessibility issues.  So when using any of these methods, like in our previous CSS examples, it would only makes sense to use them, if the context of there useage doesn’t impact accessibility.</p>
<p>JQuery also gives you a few DOM manipulation techniques, that obviously affect the Accessibility Tree:</p>
<p><a href="http://api.jquery.com/detach/" target="_blank">.detach()</a><br />
<a href="http://api.jquery.com/remove/" target="_blank">.remove()</a></p>
<p>There are others, but these are the two most commonly used.  The main difference between the two is that <code>.detach()</code> will allow you to bring the element back into the DOM, <code>.remove()</code> won’t.  Again use with caution.  In the case of a cookie policy message that is only ever viewed once by the user, either of these might be a good option.</p>
<p>Another problem comes from inaccessible JavaScript methods for adding content:</p>
<p><a href="http://www.w3schools.com/jsref/met_doc_write.asp" target="_blank">write()</a><br />
<a href="http://www.w3schools.com/jsref/prop_html_innerhtml.asp" target="_blank">innerHTML()</a></p>
<p>The problem with both, is that they don’t interact with the DOM.  As such elements added via these methods most likely will be ignored by all assistive tech.  So avoid these like the plague!</p>
<p><a href="http://www.buildabear.co.uk/" target="_blank">Build a bear</a> is one of my daughters favourite shops.  They commit a double crime, with their flash not enabled warning.  Firstly they exclude it from assistive tech as the <code>write()</code> method isn’t interacting with the DOM.  Next they write in an image, with no alternative description.  So they may as well display nothing, for all the use it provides to assistive technologies.</p>
<p style="text-align: center;"><a href="http://www.bettertesting.co.uk/content/wp-content/uploads/2012/12/buildabear.png"><img style="margin-bottom: 4px;" src="http://www.bettertesting.co.uk/content/wp-content/uploads/2012/12/buildabear.png" alt="Build a bear no flash warning example." width="620" height="450" /></a><br />
<span style="font-size: x-small;">Example of the Build a bear websites, no flash warning.</span></p>
<p>Obviously analysing Javascript adds a little more complexity onto your testing efforts.  The most obvious way to test this, is to use some assistive technology to interact with the page, and see what is being picked up, or not.  Personally I prefer to do some quick tests in developer tools, by inspecting inline and external JavaScript and searching (CTRL + F) for problematic methods, to see what they are doing.  This way you can quickly identify where on pages they’ll be used, and test to confirm your suspicions with assistive tech.</p>
<h3>Hiding content with HTML</h3>
<p>There is a couple of attributes in HTML that can hide content from assistive tech.</p>
<h4>Hidden input fields</h4>
<p>The first is the input element&#8217;s type attribute.  If the value of its attribute is set to <a href="http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_input_type_hidden" target="_blank">hidden</a> then obviously the field will be hidden from view.  Assistive tech treats it exactly the same by ignoring it.</p>
<p><strong>HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">&lt;input name=&quot;Language&quot; type=&quot;hidden&quot; value=&quot;English&quot; /&gt;</pre>
<p>It is actually quite a common technique, that is used on most websites, to store values.  Back in the days of caveman development, when entire websites used to be constructed of forms to control layout, you could often see username and passwords being submitted in hidden fields as a form of access control.  Thankfully those days are long gone.</p>
<p>So this technique isn’t so bad, depending upon how you use it.  It’s pretty hard to mess this one up.</p>
<h4>Alt tag</h4>
<p>As a general rule of thumb if an image adds descriptive value to the context of a page, then add alternative text for it using the alt attribute.  If it is purely for decoration, add the alt attribute but leave it empty.</p>
<p><strong>HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">&lt;img src=&quot;randompicture.png&quot; alt=&quot;&quot; width=&quot;150&quot; height=&quot;10&quot; /&gt;</pre>
<p>The above randompicture.png image if used purely for decorative purposes, would correctly have a null alt attribute value.  Many assistive technologies will choose to ignore the element completely, as with an empty alt description, they assume it is for decorative purposes.</p>
<p>You might also add an image on a button with the type image, or a link anchor with an image inside it.</p>
<p><strong>HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">&lt;a href=&quot;register.aspx&quot;&gt;
&lt;img class=&quot;overlaybtn&quot; src=&quot;register.png&quot; alt=&quot;&quot; width=&quot;32&quot; height=&quot;12&quot; /&gt;Register&lt;/a&gt;</pre>
<p>In the above example you might confuse the need for adding alt text if the image overlaps the anchors link description.  As the anchor already has a link description “Register” adding the alt of “Register” again would merely duplicate the content.  For most assistive tech, duplicate content would be read twice, sometimes without any context, e.g. <em>image alt: register, register link</em>, might simply be processed as register, register link.</p>
<p>So it’s worthwhile noting that alt attributes with a empty value will be ignored by assistive technologies.  Let’s not talk another further about the specifics of alt attributes and how to use them correctly, because that is a topic for another time, and already covered in great detail all over the web.</p>
<h4>HTML5 hidden attribute</h4>
<p>HTML5 brought us a new attribute called <a href="http://www.w3schools.com/tags/att_global_hidden.asp" target="_blank">hidden</a>, which when used hides the element it has been applied to from view.</p>
<p>As far as I could tell, all current browsers that support this attribute, simply apply a style of <code>display:none;</code> to the element.  So effectively when used this will be ignored by screen readers, so use with care.  As we have already discussed with the CSS technique, sometimes it is useful to use <code>display:none;</code> and other times it can impact accessibility.</p>
<div class="main-caption">
<p>Currently the way that browsers are treating this attribute, by applying a style of <code>display:none;</code> to it, for me seems pointless.  CSS was of course created for this purpose: controlling presentation of the page.  So I would argue that creating an attribute to control something that is already done via CSS, is pointless.</p>
<p>This attribute would be much better served by automatically applying the clip technique and assign on page generation a <a href="http://www.w3schools.com/tags/att_global_tabindex.asp" target="_blank">tabindex attribute</a> to the element, with a value of -1.:</p>
<p><strong>CSS</strong></p>
<pre class="brush: css; title: ; notranslate">.hidden {
position: absolute !important;
height: 1px; width: 1px;
overflow: hidden;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
}</pre>
<p><strong>HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">&lt;a tabindex=&quot;-1&quot; href=&quot;#maincontent&quot;&gt;Skip to content&lt;/a&gt;</pre>
<p>At least now it can be used by assistive technologies in conjunction with <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-hidden" target="_blank">aria-hidden</a> to provide content for assistive technologies.  Currently though what it does, is completely redundant.</p>
<p>Of course though, we could just live with it and think semantically that yes, perhaps hidden is indeed hidden, and as such display:none; would make sense.  You can flip a coin both ways I guess, so who am I to argue?</p>
</div>
<h3>Hiding content from the Accessibility Tree with WAI-ARIA</h3>
<p><a href="http://www.w3.org/WAI/intro/aria.php" target="_blank">WAI-ARIA</a> introduces a couple of ways to hide content from assistive technologies.</p>
<h4>The aria-hidden attribute</h4>
<p>Sometimes it might make sense to hide visual content from assistive technologies.  To do this we make use of the <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-hidden" target="_blank">aria-hidden</a> attribute.  If you are displaying duplicate content because it fits with the design, rather than having the content interpreted twice by a users of assistive tech, you can hide the most sensible instance using aria-hidden.</p>
<p><strong>HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">&lt;img src=&quot;decorative.png&quot; alt=&quot;&quot; aria-hidden=&quot;true&quot; /&gt;</pre>
<p>In the above example HTML it might even make sense to use aria-hidden to make sure decorative images are not read out by assistive technology.  Although some assistive tech will ignore images with empty alt tags, not all will, so doubling up with <code>aria-hidden=”true”</code> helps our chances.  I say chance, because support in both assistive technologies and browsers is a bit lacking.</p>
<h4>Presentation role</h4>
<p>The <a href="http://www.w3.org/TR/wai-aria/roles#presentation" target="_blank">presentation role</a>, is used to convey that an element is used for presentational purposes only.  As such, these elements would provide no benefit to users of assistive technologies and should therefore be ignored.</p>
<p><strong>HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">&lt;img src=&quot;decorative.png&quot; alt=&quot;&quot; aria-hidden=&quot;true&quot; role=&quot;presentation&quot; /&gt;</pre>
<p>Again using the same example as used in the aria-hidden example, specifying an element with the presentation role, further increases our chances of it being ignored by assistive tech, but still having it remain visually on screen.</p>
<p>Specification example use cases:<br />
1. An element whose content is completely presentational (like a spacer image, decorative graphic, or clearing element);<br />
1. An image that is in a container with the img role and where the full text alternative is available and is marked up with aria-labelledby and (if needed) aria-describedby;<br />
2. An element used as an additional markup &#8220;hook&#8221; for CSS; or<br />
3. A layout table and/or any of its associated rows, cells, etc.</p>
<p>So useful, but again lacking real support from browsers and assistive technologies.</p>
<h3>Summary</h3>
<p>So I hope you are now more aware of how elements can be intentionally, or unintentionally hidden from assistive technologies.  There is a lot to consider, but the most important aspect, is to consider the context of the element/container in question before deciding if the technique is correct, or not.</p>
<p>Thanks for reading.</p>
<div class="shr-publisher-1672"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>https://www.bettertesting.co.uk/content/?feed=rss2&amp;p=1672</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Emotional Avatars – What and Why</title>
		<link>https://www.bettertesting.co.uk/content/?p=1665</link>
		<comments>https://www.bettertesting.co.uk/content/?p=1665#comments</comments>
		<pubDate>Wed, 07 Nov 2012 00:51:21 +0000</pubDate>
		<dc:creator>Darren McMillan</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Usability]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://www.bettertesting.co.uk/content/?p=1665</guid>
		<description><![CDATA[Overview Tonight I had the opportunity to attend my 2nd Scottish Usability Professionals&#8217; Association event in Edinburgh.  It was a good night which saw two speakers from the University of...]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><h2>Overview</h2>
<p>Tonight I had the opportunity to attend my 2nd <a href="http://uxpa-scotland.org/" target="_blank">Scottish Usability Professionals&#8217; Association</a> event in Edinburgh.  It was a good night which saw two speakers from the University of Abertay delivering two very different talks.</p>
<p>I am not going to talk about both.  Instead I would like to share my notes and thoughts on Dr Jackie Archibald’s talk titled: Emotional Avatars &#8211; What and Why, which I found extremely interesting and thought provoking.</p>
<h2>Emotions</h2>
<p>The talk saw Jackie begin by explaining the role emotion plays in modern day human computer interactions.  She discussed aspects such as perception, cognition, creativity and our ability to cope as reactions triggered by our emotions.  She also discussed how our current emotions can affect our memory, ability to plan, or complete tasks, and our ability to make decisions.  She went on to explain how displaying your emotions can often be seen as a negative thing.  People may questions your ability to work logical, or even think rationally.  However, she explained that emotion is important, and can aid interaction in an intelligent way.</p>
<h2>Avatars</h2>
<p>With the reasoning out of the way, next came the interesting part &#8211; emotional avatars.  She explained that an emotional avatar, was simply a virtual character who could display, and / or recognise emotions.  The use for them she suggested could be in education, training and as help systems.  She provided a example of a virtual avatar which was used in New Zealand to help teach kids working from home, which could help guide them through lessons.  This was called Easy with Eve, and supposedly could detect facial patterns in students and react to them.</p>
<p>She provided a few more examples, of avatars currently in use:</p>
<ul>
<li><a href="http://www.ikea.com/gb/en/" target="_blank">Asking Anna, the IKEA bot</a></li>
<li><a href="http://help25.creativevirtual.com/tescomob/bot.htm?isJSEnabled=1" target="_blank">Ask Rachel, Tesco</a></li>
<li><a href="http://usa.kaspersky.com/support/home/sasha" target="_blank">Virtual agent Sasha, Kaspersky</a></li>
</ul>
<p style="text-align: center;"><a href="http://www.bettertesting.co.uk/content/wp-content/uploads/2012/11/emotional-avatars.jpg"><img style="margin-bottom: 4px;" src="http://www.bettertesting.co.uk/content/wp-content/uploads/2012/11/emotional-avatars.jpg" alt="Emotional avatars presentation." width="620" height="400" /></a><br />
<span style="font-size: x-small;">Jackie, showing Virtual agent Sasha, the Kaspersky bot.</span></p>
<p>All very interesting and sharing one common trait &#8211; they are all provide support desk type feedback.  Perhaps this is how future FAQs (frequently asked questions) will turn out?  None from what I could gather had any concept of emotions, but simply how to display them.</p>
<p>Now the talk became more interesting as Jackie went on to explain the research three of her students had done around this area.</p>
<h3>Dealing with frustration</h3>
<p>The first student, John Hart had completed a research project titled “Dealing with frustration”.   He began by surveying opinions on virtual agents such as the Asking Anna IKEA bot.  The general feedback not surprisingly, was that people were not overly impressed by them.</p>
<p>For the next step of his project, John developed a travel website which intentionally frustrated users with introduced delays and broken links.  As people used the site it was noted their frustration levels began to rise.</p>
<p>His final step was to develop an emotional avatar, which would see if it could assist in reducing user frustrations.  He would then be able to introduce an agent to help assist the user, using affective language via a text based conversation panel.</p>
<p>What he found was:</p>
<ul>
<li>Users were both frustrated with the avatar and the website.</li>
<li>Avatar frustrations seemed to stem from its limited knowledge base, meaning it struggled to answer certain questions asked of it during the studies.
<ul>
<li>The avatar provided no help to overly frustrated users.</li>
<li>Moderately frustrated users which it successfully responded to, noted reduced frustration levels to some extent.</li>
</ul>
</li>
</ul>
<p>Interesting, but without seeing the research myself it is hard to make much of it.  The approach appears open to a lot of bias and assumptions.  The fact that surveys were employed as a research tool, doesn’t hold much weight really in my opinion.  How, or when he decided to inject the avatar as well, I’m unsure of.  Still, it is very interesting and opens up ideas for how these could be used as a means of online engagement with users based upon some sort of emotional rules engine.</p>
<h3>Improving self service systems via emotional virtual agents</h3>
<p>Next up was PHD student Chris Martin, who was doing a research project titled: Towards improvement of self service systems via emotional virtual agents.  This project looked into how the user experience of a self service system such as a supermarket self service checkout.  The idea being that an empathetic system could be developed, which could understand, reason and react to peoples emotions.</p>
<p>The first stage of his project involved filming (with permission) people using supermarket self service checkouts, and noting their facial reactions while using them.  These would be logged as <a href="http://en.wikipedia.org/wiki/Facial_Action_Coding_System" target="_blank">facial action units</a> and when reviewed patterns could be identified.  It was found that the two most common action units related to anger.</p>
<p>For his next stage, knowing that anger was the most common response to these systems, he wanted to determine the most appropriate response an agent should provide to the user.  To do this he created a system which would mimic a self service checkout, but intentionally block the users from completing their task.  At this point, an affective agents (emotional avatar) would be introduced, and their response to the avatar would be recorded.  Seven different types of avatar were used to determine which was most suitable.  Each of these had a different facial expression:</p>
<ul>
<li>Anger</li>
<li>Disgust</li>
<li>Fear</li>
<li>Neutral</li>
<li>Happy</li>
<li>Sadness</li>
<li>Surprise</li>
</ul>
<p>Of these, the one found to be the most inappropriate to use was disgust.  The one which received the most positive reaction was the neutral avatar.  I sought clarification after the talk if text was displayed to the user to match these differing emotions, but it appears that only an avatar image was presented to the user.  I assume some processes were still available to the user at this point to progress or cancel the checkout process though.</p>
<h3>Usable security via affective feedback</h3>
<p>The final research project titled: Usable security via affective feedback, was being done by a student named Lynsay Shepherd.  This one though was only just starting, so there wasn’t much to cover research wise, as none had really been done yet.</p>
<p>This project would look at how systems could improve risk awareness in end users using affective feedback.  Users would then become more aware of the risks their behaviour could introduce.</p>
<h3>Thoughts</h3>
<p>All in all, it was a really interesting talk and for that reason alone I’m glad I took the time out to attend.  I struggle though to see how avatars using current technology can react to end users.  I did ask the question and Jackie provided a decent enough response, although perhaps not quite what I was looking for:</p>
<ul>
<li>Biometrics could be used to determine user emotions.</li>
<li>Mouse devices with hand grip detection, to determine frustration.</li>
<li>Cameras which monitor facial reactions.</li>
<li>Language used during text interaction with the avatar.</li>
</ul>
<p>The last point certainly seems valid.  What would this be useful for though?  FAQ type systems?  Could you possibly drive site navigation via a keyword driven avatar, returning differing results depending on gauged emotions?</p>
<p>My thoughts with current technology are that outwith user inputs such as direct textual conversation, it is hard to gauge emotion.  I do think though that some form of rules engine could be developed to determine emotions and react to the user in different ways.  For example if the user exhibits some form of navigation pattern while using a website, which indicates that they might be lost, perhaps an avatar would help negate negative emotions, and if it successfully helps them find where they need to go, perhaps their mood may then even be positive.  Or, what if the user is found to be on a checkout process for some time, perhaps an avatar could be injected onto the page to provide assistance.</p>
<p>Regardless, I think relying upon hardware for now, is a non starter.  Perhaps as devices become more camera ready ( mobile is certainly miles ahead of desktops currently), then detecting facial emotions might not be so far away.  There is a big assumption of course that people will want their devices monitoring them, which I think is very unlikely to be a given, for many obvious reasons.</p>
<p>There is serious potential though for emotional avatars.  I’m still unsure where though.  The world certainly could do without another <a href="http://en.wikipedia.org/wiki/Office_Assistant" target="_blank">Microsoft Clippy</a> that’s for sure!  With some thought though and making use of behavioural interaction modules that new content management systems are now beginning to make available, I think there could be room for these emotional avatars to build empathic relationships with users.</p>
<p>Thanks for reading.</p>
<div class="shr-publisher-1665"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>https://www.bettertesting.co.uk/content/?feed=rss2&amp;p=1665</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Accessibility considerations: Visual indicators for keyboard navigation</title>
		<link>https://www.bettertesting.co.uk/content/?p=1636</link>
		<comments>https://www.bettertesting.co.uk/content/?p=1636#comments</comments>
		<pubDate>Sat, 18 Aug 2012 10:08:09 +0000</pubDate>
		<dc:creator>Darren McMillan</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[learning]]></category>

		<guid isPermaLink="false">http://www.bettertesting.co.uk/content/?p=1636</guid>
		<description><![CDATA[Summary Often when a site is designed, developers will set the outline for navigation elements to none, or zero.  Effectively this means that when you try to navigate a website...]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><h2>Summary</h2>
<p>Often when a site is designed, developers will set the outline for navigation elements to none, or zero.  Effectively this means that when you try to navigate a website using a keyboard, visually you will have no idea where you are on the page which most often than not forces user to use a mouse.  This is fine until a user becomes dependent upon the keyboard for navigation &#8211; such users, who cannot use a mouse suddenly become severely impacted by the pages inability to highlight what they are currently navigating through.  Of course it&#8217;s not just an accessibility flaw, some people just like to use the keyboard to quickly navigate items.</p>
<p style="text-align: center;"><a href="http://www.bettertesting.co.uk/content/wp-content/uploads/2012/08/linkoutline.png"><img style="margin-bottom: 4px;" src="http://www.bettertesting.co.uk/content/wp-content/uploads/2012/08/linkoutline.png" alt="Link outline example." width="620" height="60" /></a><br />
<span style="font-size: x-small;">Example of a link outline appearing when the user navigates links using their keyboard.</span></p>
<h3>Why do people remove it?</h3>
<p>Some people just hate the sight of a link outline.  Much like how visited links are often styled to be the same colour as non visited links to the detriment of accessibility and usability, simply to appease a design – the good old link outline can often suffer the same fate.</p>
<p>Interactive elements controlled using Javascript and styled for example as oversized fancy call to actions are often the first to suffer, as 99% of the time these controls are just link anchors styled and controlled using JavaScript to appear all fancy and interactive.   If the developer hasn’t already removed the link outline, you can guarantee that when someone sees the outline around their beautiful call to action, a complaint that it doesn&#8217;t look very nice will follow.   The outline will likely later be removed, without a suitable keyboard accessible alternative put in place.</p>
<h3>Applying and removing link outlines</h3>
<p>Outline can be applied using the CSS <a href="http://reference.sitepoint.com/css/pseudoclass-focus" target="_blank">:focus selector</a> on a targeted HTML element like below:</p>
<p><code>a:focus { outline: 1px dotted; }<br />
selector:pseudo-class { propery:value; }</code></p>
<p>This declaration essentially says that for all link anchors (a tags) when they have focus, apply the property outline with a width of 1px, dotted.</p>
<p><code>a:focus { outline: 0; }</code></p>
<p>The above will have the reverse effect, by removing the link outline for all anchors.  This now impacts keyboard accessibility.</p>
<h3>So what if I still don’t want to apply a link outline?</h3>
<p>Not setting an outline is fine, as long as you can provide an alternative style for it.  The main objective is to provide keyboard accessibility here, so as long as you have a suitable alternative accessibility will not be impacted.</p>
<p>Rather than using a link outline, perhaps changing the text colour when the link is in focus would be a suitable alternative.</p>
<p style="text-align: center;"><a href="http://www.bettertesting.co.uk/content/wp-content/uploads/2012/08/linkoutlineb.png"><img style="margin-bottom: 4px;" src="http://www.bettertesting.co.uk/content/wp-content/uploads/2012/08/linkoutlineb.png" alt="Alternative example to link outline styles." width="620" height="45" /></a><br />
<span style="font-size: x-small;">Example of outline removed with the text colour change replacing it when the link is in focus..</span></p>
<p>This can be easily achieved with a little tweak to your CSS:</p>
<p><code>a { text-decoration: none;}</code></p>
<p><code>a:focus { outline: 0; text-decoration: underline; color: red;}</code></p>
<p>So now we are essentially telling anchors which don’t have focus to not underline their text (text decoration = none).  Anchors with focus now also have their outline removed and instead have their text underlined and in red.  Very simple and design wise and probably an improvement for visual indication of an item in focus.</p>
<p>As long as you maintain a good colour contrast for alternative styles when you choose to not use outline for elements in focus and keep a decent level of consistency in terms of colour choices, then accessibility should not be impacted.</p>
<h3>Is that it?</h3>
<p>As long as you ensure that all interactive and navigation elements on a page have a focus effect applied for keyboard navigation then you should be fine.  A good <a href="http://en.wikipedia.org/wiki/Rule_of_thumb" target="_blank">rule of thumb</a> to use for this would be checking if anything with a hover (mouse over) effect, also has an equivalent keyboard accessible focus effect.  Manual inspection would still be required though, to make sure nothing was missed that didn’t have either a hover or focus effect.</p>
<h3>Compatibility issues with older browsers</h3>
<p>Now is probably a good point to highlight the issues that will arise with solely relying upon the CSS :focus selector to apply highlighting for items in focus.  On older versions of Internet Explorer (IE), the :focus selector wasn’t supported, so to get around this we use another selector <a href="http://reference.sitepoint.com/css/pseudoclass-active" target="_blank">:active</a>.  Active will allow you to style currently active elements on IE6 and 7, but for IE7 it will only work on anchor elements (links).</p>
<p>If you don’t want to be limited in IE7 to anchors, you can make use of a JavaScript library called <a href="http://code.google.com/p/ie7-js/" target="_blank">IE7-js</a> (actually a series of library’s for IE7-9), which will allow you to make use of the: active selector on other elements just by loading the library via a conditional statement in your document.  If you want to go one step further and don’t need to support IE6, you can ignore :active and gain support for the :focus selector in IE7 by including <a href="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE8.js" target="_blank">IE8.js</a> in your conditional statement.</p>
<h3>How do I test for this?</h3>
<p>The simplest test would be to check page navigation with the keyboards tab key, to check if an outline or alternative style is applied around the element in focus.  If it doesn’t, then this means a style has not been considered for keyboard navigation.</p>
<p>Another quick test would be to open developer tools (F12 on most browsers) while viewing the web page and inspecting the sites style-sheets.   A good rule of thumb here, is that any declaration that has :hover set on a selector, should also have both :focus and :active equivalents.</p>
<p style="text-align: center;"><a href="http://www.bettertesting.co.uk/content/wp-content/uploads/2012/08/csstest.png"><img style="margin-bottom: 4px;" src="http://www.bettertesting.co.uk/content/wp-content/uploads/2012/08/csstest.png" alt="Accessible CSS declaration example" width="620" height="450" /></a><br />
<span style="font-size: x-small;">Example of a good declaration, which includes :active and :focus for keyboard navigation styles.</span></p>
<p>Sometimes though, poor markup implementations affect your ability to target elements for styling.  This usually occurs when non standard markup is used for interactive elements in combination with JavaScript event handlers such as onclick to provide some form of interactivity e.g. <code>onclick="window.open('http://www.someurl.com')"</code> (on selection, open in a new browser window this URL).  So it is always important to go over navigation elements with a fine comb to weed out anything you may have missed.</p>
<p>The last test is actually an oddity which is rarely done.  Sometimes HTML elements on a page which would not normally be included in the keyboard navigation cycle are forced to be included by assigning the <a href="http://www.w3schools.com/tags/att_standard_tabindex.asp" target="_blank">tabindex attribute</a>.  There may be a good reason for doing so, but I&#8217;ve yet to see one.  Normally depending upon how your stylesheet has been configure for elements, these items would be excluded from keyboard accessible visual indicators such a outline.  Unless you can justify a good reason for them to be included in the tabindex, I would normally suggest removing them.  Every browser worth testing these days automatically indexes HTML elements which should be included in the tab order, so taking over its control to include non standard elements often impacts accessibility, so be careful.</p>
<p>Thanks for reading.</p>
<div class="shr-publisher-1636"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>https://www.bettertesting.co.uk/content/?feed=rss2&amp;p=1636</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>