WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Jquery.focus() and screen reader

for

From: Swift, Daniel P.
Date: Aug 16, 2017 7:52AM


Try adding tab index 1:

jQuery('.licence-agreement').attr("tabindex",1).focus();

Does that help? If that works, you need to remember to remove the tab index when they close the modal box.

Dan Swift
Senior Web Specialist
Enterprise Services
West Chester University
610.738.0589

-----Original Message-----
From: WebAIM-Forum [mailto: <EMAIL REMOVED> ] On Behalf Of Ócsvári Áron
Sent: Wednesday, August 16, 2017 7:45 AM
To: WebAIM Discussion List
Subject: [WebAIM] Jquery.focus() and screen reader

Hello,

I have a jQuery script. When I click a link, a non-modal windows pops up, and show a text.

I added alert role for the div, so my screen reader (NVDA) announces it properly. My problem is that the focus of NVDA does not move to this text.

What would be the sollution for this? My code are the following:

jQuery('.licence-agreement').attr('role', 'alert'); jQuery('.licence-agreement').show().css("position","absolute");

jQuery('.licence-agreement').focus();

The html:

<div class='licence-agreement'style='display:none;'>
<p>Hello!</p>

...

</div>

Thanks for your help!

Regards,

Aron