Page MenuHomePhabricator

Mobile section editing sometimes scrolls to the wrong place
Closed, ResolvedPublic


Edit the lede section on

Observe that you are scrolled to the middle of the third paragraph, not the start of the first.

Event Timeline

This seems to affect all pages, e.g. also

I put a breakpoint in VisualEditorOverlay#scrollToLeadParagraph to see what is happening (this mangled code, blergh):

image.png (2×3 px, 732 KB)

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.

Change 553870 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/MobileFrontend@master] mobile.editor.overlay: Fix scrolling to lead paragraph

It doesn't affect all pages, e.g. works fine.

Apparently that page has a valid cursor position before the infobox, because of the templates like "Use American English".

image.png (2×3 px, 1 MB)

Change 553870 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] mobile.editor.overlay: Fix scrolling to lead paragraph