webpage scrollbar scrolls to top when typing in input box, how to fix?
Posted
by
derei
on Stack Overflow
See other posts from Stack Overflow
or by derei
Published on 2013-10-31T23:19:05Z
Indexed on
2013/11/05
21:54 UTC
Read the original article
Hit count: 213
JavaScript
|scrollbar
I have a HTML table that is scrollable and I'm forcing the scroll bar at the bottom. But every time I type something in a input box situated inside <thead>
it scrolls back to top.
I have no idea how to stop it to do that...
I'm sorry for not explaining it better, if anybody wants to help, I could provide a link. I cannot place it public because is a private project.
Thanks, let me know.
EDIT
-added jsfiddle example (below is the link)
click here for jsfiddle example
EDIT2
the issue seem to be present only in Chrome, but that it's more than enough (the app is intended to be used in chrome)
EDIT3 I found a similar issue here: on webkit browsers typing into edit box causes scrolling , so the problem seem explained: the parent element gets focus on the side where the input-box is. I verified this on a mockup-template and it acts accordingly.
*The question is:*how to prevent this to happen? I am forced by situation to have the input-box as child for the scrollable div, but I don't want that scroll to move (somehow to not give focus to the parent element, when I type in the input-box).
Any idea?
© Stack Overflow or respective owner