WebAIM - Web Accessibility In Mind

E-mail List Archives

Focus on heading, span, paragraph tags

for

From: Rakesh
Date: Oct 14, 2013 10:24AM


All,
To contribute best to my blog http://www.maxability.co.in, I am learning
javascript. My target is to put as many code examples as I could on my
blog with which developers could be benefited.

I am currently working on focus. I have tried to set focus on an element
when a button is clicked. The focus is perfectly working when I use NVDA
on internet explorer and Firefox. while using JAWS the focus cannot be
set to elements such as paragraph, span and headings. Even for elements
such as buttons, text boxes and anchor tags the focus is working only once.

Below is the code I have used.
HTML code:

<p id="ct">Changing content using javascript function</p>
<input type="button" onClick="testFocus()" value="return to top">

Javascrpt Code:

<script>
function testFocus()
{
var target = document.getElementById('ct');
target.setAttribute("tabindex" , "0");
document.getElementById("ct").focus();
}
</script>

Thanks & Regards
Rakesh Paladugula
www.maxability.co.in