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!
This is a visual focus problem, when you load the page focus is placed on the document (by the browser) and the first link is already focused (by NVDA) if it isn't wrapped in a <ul>. NVDA also doesn't report that the item is focused using NVDA + Tab.
When in Browse mode, by default, NVDA will automatically switch to focus mode if you tab to or click on a particular control that requires it. Conversely, tabbing to or clicking on a control that does not require focus mode will switch back to browse mode.
Published October 23, 2020 To remove the focus on an input tag element in HTML, you can use the blur () method on the element using JavaScript. // remove focus from the element element.blur (); Let's say we have an input tag and a button like this,
It is possible to set a default input focus on an HTML form without Javascript. This can be done in HTML5, as it allows us to use the autofocus attribute on the form element. <!DOCTYPE html> <html> <head> <title> Title of the document </title> </head> <body> <input type="text" name="myInput" autofocus /> </body> </html>
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 :)
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With