- Oct 9, 2002
- 28,298
- 1,235
- 136
I'm working on a tall form page with lots of fields. Each field is contained in a visible div that changes color to show when the field has focus. Within the DIV, just after the text box, information about the field is displayed to the user (description of what the field is asking for, validation requirements, etc). Clicking anywhere in the DIV gives keyboard focus to the text box inside it.
When pressing the Tab key to move through the fields, the user eventually end up with each text box appearing at the very bottom of the screen. I want to make it so the screen scrolls to keep the focused text box centered vertically. This would ensure that the rest of the information in the div is visible (the info just below the text box). What's the best way to do this?
When pressing the Tab key to move through the fields, the user eventually end up with each text box appearing at the very bottom of the screen. I want to make it so the screen scrolls to keep the focused text box centered vertically. This would ensure that the rest of the information in the div is visible (the info just below the text box). What's the best way to do this?