Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

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:

share|improve this question
Can we see the question/answer you are talking about? – j0k Feb 28 '13 at 13:07
What browser/version are you seeing this in? – Mike Feb 28 '13 at 13:08
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
@hims056 you can see it in the end of my vid, anyway it's :) – Shadow Wizard Feb 28 '13 at 13:35
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

You must log in to answer this question.

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