your communities

When editing posts that at first contain nothing but a huge code block, the scrollbar next to the code block always jumps to the beginning when I make edits to the code. This can get extremely annoying. Does this happen with every code block like this?

(This happens on Google Chrome version 25.0.1364.97)

Live demo:

http://www.youtube.com/watch?v=kmFp5cGAl_s

share|improve this question
2  
Can we see the question/answer you are talking about? –  j0k Feb 28 '13 at 13:07
2  
What browser/version are you seeing this in? –  Mike Feb 28 '13 at 13:08
2  
Took the liberty to add a demo, hope you don't mind. If you do, feel free to roll back. :) –  Shadow Wizard Feb 28 '13 at 13:18
    
@ShaWizDowArd - Side question. Which tool do you use for capturing screen video? –  hims056 Feb 28 '13 at 13:23
2  
@hims056 you can see it in the end of my vid, anyway it's camstudio.org :) –  Shadow Wizard Feb 28 '13 at 13:35
add comment

1 Answer

up vote 6 down vote accepted

This is kind of unavoidable, because the preview area HTML is completely rerendered as you're making changes. Since the code block you scrolled is no longer the code block that's actually there, the browser is unable to preserve your scroll position.

share|improve this answer
    
It's possible with some JavaScript, it can detect the caret position and try to restore it in the preview scroll. Not trivial, but should be possible. –  Shadow Wizard Feb 28 '13 at 13:15
    
The OP is modifying the contents of the code block they're scrolling though, so I don't see this working in any sort of reliable way. –  Tim Stone Feb 28 '13 at 13:16
    
See my demo. At least in the simple case of just adding characters to the end of the code should preserve the scroll in my opinion. –  Shadow Wizard Feb 28 '13 at 13:19
add comment

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .