|mediawiki/extensions/MobileFrontend||master||+1 -1||mobile.editor.overlay: Fix scrolling to lead paragraph|
|Resolved||matmarex||T239520 Mobile section editing sometimes scrolls to the wrong place|
|Duplicate||None||T255131 Lede section edit broken on some pages|
This seems to affect all pages, e.g. also https://en.m.wikipedia.org/wiki/Ryan_Murphy_(writer).
I put a breakpoint in VisualEditorOverlay#scrollToLeadParagraph to see what is happening (this mangled code, blergh):
It looks like the page is already scrolled so that the lead paragraph is visible (at the bottom), while the code basically assumes that the page is scrolled to the top. Possibly the target changes in VE, or some random overlay change in MF, have caused the text selection to be already set and the cursor scrolled into view, while previously this wasn't happening?
I think this is a simple bug and we just need to replace $window.scrollTop( $window.scrollTop() + offset ); with $window.scrollTop( offset );. This is my own code and I don't know why I did it this way – must have been a hold-over from some earlier approach that just happened to work because $window.scrollTop() was always 0.