Reputation: 395
We are implementing accessibility on our existing web applications. We work with Firefox and NVDA. Little introduction on our web applications : Our web applications are forms with multiple steps (step 1, step 2 : those are different web pages). Each step have a previous / next hyperlink to go to the previous or the next step. At the final step, users see their inputs and can submit the forms or go back to change values. When user go to a previous page to change some values, we put an #anchor so the page go to that anchor. Then, in Jquery, I put the focus on the first focusable element after that anchor.
This works great except when NVDA is active :
When NVDA is active, NVDA force the focus on the HTML element that was last used when user was on this page the last time. In my case, NVDA put the focus on the Next hyperlink. NVDA overrides my focus I've set in my $(document).ready() function.
I've tried to change almost all settings in NVDA but haven't found one that fix my problem.
I've search the web for any ARIA attribute I could set to tell NVDA I'll manage focus and navigation but I haven't found anything there.
Anyone know how to resolve this issue?
Thanks a lot!
Upvotes: 9
Views: 4354
Reputation: 2240
As reported by digitaltoast the behavior is by design, see Focus cached on form submission #5351
Directly, the focus is not being cached. We're caching the user's last position on the page, which indirectly causes the focus to be changed. Caching the user's last postion is necessary to ensure that navigating back and forward between pages, restoring a closed tab/window, etc. puts the user in the right position, which is a feature our users require and expect. Unfortunately, it does have the side effect you describe.
The issue does not appear if the URL changes, so a possible solution could be to add a random parameter to the query string
A GET form seems to be not affected (URL changes) until is submitted with same data (URL is the same), then issue shows up.
I noticed also that the issue is not present if the form is in an IFRAME
Upvotes: 2
Reputation: 689
I know this is a few months old, but I've just run into the same problem and after a long night of banging my head against the desk, I asked on the NVDA bug tracker and it turns out that this strange behaviour is actually by design(!)
Anyway, I found a fix that works for me, anyway, with Firefox 32 and NVDA 2014.2
$(document).ready(function() {
function resetTab(){
document.getElementById('toplink').focus();
}
window.setTimeout(resetTab, 250);
});
Needs jQuery or another method of detecting a loaded window. And obviously needs an element with the id of "toplink" too, or change the ID in the code. Let me know if this works for you :)
Upvotes: 2
Reputation: 3392
In my case, NVDA put the focus on the Next hyperlink. NVDA overrides my focus I've set in my $(document).ready() function.
This sounds like if a person clicks on previous, you are doing
<a href="#" onClick="history.go(-1); return false;">Go back</a>
Which I think it might be a browser-related issue. Some remember where you were after you leave a page. Since you are not reloading the page, just going back, ready()
is not firing again. The question of making ready()
fire again, was already asked, which may be some some help. But you may have some issues determining if the user pressed back, given my assumption.
I've search the web for any ARIA attribute I could set to tell NVDA I'll manage focus and navigation but I haven't found anything there.
ARIA will do nothing here. The issue is how you are navigating backwards in your application.
The only way I can fix this is to re-engineer the application. If you are relying on history.go(-1)
, you will need to make a new function that mimics ready()
.
Upvotes: 0