1

Right now, I'm developing a dojo widget that acts as a validation widget for a piece of user information. The main concept is that there is a div with a nested input and a nested div with a further nested input so basically:

<div id="top">
    <input name="pass">
    <div id="collapse">
        <input name="passvalidate">
    </div>
</div>

What is supposed to happen is that if there is nothing in pass, then passvalidate should not be accessible and collapse should be be collapsed and hidden. The way I'm making this happen right now is that I am latching onto the keydown event of the pass input field and if the key is tab and the pass field is not empty, the tabindex of passvalidate changes so that it can be tabbed to.

If the validation field becomes selected, and the user tabs again, then they are taken to the top of the page since the actual element for the passvalidate is located at the bottom of the page, far far away from where it seems to be in tabflow.

My implementation works fine. I haven't run into any errors with that which is why I'm only really posting psudocode. However, one of the other developers on the team seems apposed to altering element's tabindex if it isn't necessary. I can't really think of another way to do this without much more complicated and hard coded handlers to make sure that they can't tab into the validation field when they shouldn't.

So the bottomline question is, is altering tabflow with tabindex programatically a safe way to ensure this behavior, or could I potentially run into problems where a browser might adversely react to having its page's tabindexes altered periodically?

zero298
  • 25,467
  • 10
  • 75
  • 100
  • I think altering the flow of tabbing dynamically is not the right thing to do, usability wise. Maybe you can show a validation message that the user can click on to go to the related field? Or even scroll to the field if you want – Ruan Mendes Mar 18 '14 at 16:08
  • I would alter the design if I could, but the client wants to have this drawer feature. There is also a ton of validation messages that pop up on the screen as well throughout the form. – zero298 Mar 18 '14 at 16:29

0 Answers0