I have a div that contains a table that has many rows in it. The scrollbar displays correctly and works correctly when using the mouse. However, in an effort to make it keyboard driven I have made the div have focus and then being able to use the arrow keys (via a onKeyPress event I am able to move up and down the div.
This works except for a little quirk… When the div gains focus and I press the down arrow key, the scrollbar also moves down (effectively hiding the row I’m now currently focused on). So my question is, is there any way to avoid this from happening?
I was looking at the following commands: doScroll(), or scrollTo(), or scroll()
Would any of those work or is there something else I could do to correct the behavior of the scroll bar?
Maybe you can do a
event.preventDefault()on the arrow keys.