I have an issue with website markup on WebKit browsers (Chrome & Safari), i.e. when I type something in edit box of right-slider, it scrolls the left area.
Please take a look at following example:
http://jsbin.com/obiyec/7
http://jsbin.com/obiyec/7/edit – html code (input is inside div with id=”palette”)
- Open next link in Chrome or Safari
- Type something in edit box in right upper corner
- Notice that scrollbar in left area shifts
It is very unlikely to change this markup radically if possible
Q. How to prevent scroll-bar from shifting and make it behave same way as it is in FF?
The problem here is that what it looks like you are doing and what you are actually doing are two different things.
It looks like the
divon the left with a fixed width andoverflow: auto(div#kb-board) and the input field on the right are unrelated elements – but they are not. The input field is actually a child ofdiv#kb-boardbut its parent (div#palette) hasfixedpositioning so it sits in the top right of the page.As a result, the input field is actually on the right hand side of
div#kb-boardand when you type in it the scroll bar moves as you are giving focus to the right hand side of that div.So in this case, I would say Chrome is showing the correct behavior.
To resolve this you should stop nesting
div#palettewithindiv#kb-board. Since it uses fixed positioning, there is no need to nest it.Working example: http://jsbin.com/obiyec/8