3

Scenario:
In my application, content in Iframe is loading from server side and entire markup comes from the backend. There is navigation menu buttons in the main html page and Skip to main content link. Role for the iframe body is given as "application"(also tried with document). When Skip to main content is removed, the JAWS read the iframe content as expected, but as soon as "Skip to main content" section is enabled, JAWS reads just the first line inside iframe. What aria role or property I should add, such that when focus is moved from "skip to main content" to iframe, JAWS should start reading the entire content inside iframe? enter image description here Sample code used to move focus inside iframe:

window.skipNav = function(event) {
switch(event.type)
{
case "keydown":
if (event && event.keyCode == 13) {
setTimeout(setFocusIframe, 100);
}
break;
case "click":
setTimeout(setFocusIframe, 100);
break;
default:
break;

}

}

function setFocusIframe() {
this.iframe[0].contentWindow.document.body.focus()
// var f = jQuery("iframe:first")
// if(f.length > 0) {
// //f[0].contentWindow.document.body.focus();
// f[0].contentWindow.focus();
// console.log("skipNav-------------------------------------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
// }
}
Chetan Sachdev
  • 738
  • 1
  • 12
  • 31

1 Answers1

0

Try to check if document.activeElement returns the element you are trying to focus on.

Sometimes jQuery .focus() fucntion dont do what you expect.

jomoji
  • 5
  • 5