Update: As of version 1.0.57 (coming out later today) this is fixed. You can now scroll horizontally on code blocks or tap on them to view them in the bigger view, and a minor swipe up or down while you're scrolling the code block won't cause a "jump" movement.
Story time:
Originally viewing a question and answer page in our application looked like this:
Questions and answers were separated by tabs that you could swipe to switch between. As a result, trying to scroll a code block horizontally lead to a collision with the base view's horizontal scrolling for switching between the two. So, we made code blocks clickable to open them in a new overlay where this wouldn't be an issue. That's what the little triangle on the top right represents.
As of a few months ago, answers are now below questions like they are on the sites. When we made this change however, we forgot to go back and think about the process that had resulted in what we have for code block functionality. The current ability to horizontal slide a little in the code blocks is actually a bug, looking at the code you can see what's causing it:
String blockOverflowValue = allowBlockScrolling ? "auto" : "hidden";
String defaultStyle = "<style>html { -webkit-text-size-adjust: none; font-family: Helvetica; font-size: " + fontSize + "; }\n" +
"body { padding: 0; margin: 0; }\n";
if (allowBlockScrolling)
defaultStyle += "pre, blockquote { -webkit-overflow-scrolling: touch; overflow: " + blockOverflowValue + "; background-color: #eee; }\n";
allowBlockScrolling
is a parameter that's set for views that should be scrollable (e.g. looking at a code block in the post-click overlay view), but as you can see when that is set to false
(as it is for the base question & answer views) we are actually not setting anything to make the code not scrollable, which is causing the weird functionality of small jump-like scrolls you are seeing.
So, the code is currently trying to stop horizontal sliding on all code blocks but due to that bug it's failing and causing what's happening here, but you know what: Now that we don't have the collision with the Q&A tabs you should be able to horizontally scroll code blocks.
This is what I'm working on right now. As of the next update (1.0.57+) you will be able to seamlessly scroll code blocks while viewing a question, and if you would like you can still tap them to view a bigger-screen version of the code in an overlay.