Page MenuHomePhabricator

CodeMirror creates a gap between real and visual text vertical position after scrolling down
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce:

  • Edit a page with WikiEditor (2010) and enable CodeMirror
  • Scroll down with mouse wheel as much as you can. Note the empty blank space below last 32nd line.
  • Click on noinclude at 26th line (e.g. between o and i letter). Note the caret position.
  • Disable Syntax highlighting with pencil button. Then re-enable it clicking the pencil again. Note the scrollbar is not at bottom utmost.
  • Scroll down.
  • Click on 26th line. Note the caret position.

What happens?:
You may scroll down higher than last line.
The caret blinks at 24th line: your cursor is at 24th line whereas you click on 26th line.
After a while or some actions (e.g. scroll up and click several times in textearea), bottom blank space is removed and your click location becomes consistent with cursor location.

What should have happened instead?:
Where you click should always be where the cursor becomes located.

Software version, regression info:
Tested with Firefox 91 and Chromium 90.
I had not notice this really annoying bug before the previous week, that’s why I tag it as a regression.

Related Objects

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

@Pols12 does this seem to be the same error as reported on the English Wikipedia (perma)? If so, patch 776270 by @ElijahPepe may resolve this.

Also happens with Google Chrome 100 in thwikisource and thwiki (and more).

Frostly triaged this task as High priority.Apr 3 2022, 6:16 PM
Frostly subscribed.

Triaging as high as most likely there is a patch fixing this.

Change 776270 had a related patch set uploaded (by Samtar; author: ElijahPepe):

[mediawiki/extensions/CodeMirror@master] Reload CodeMirror to fix a caret issue

https://gerrit.wikimedia.org/r/776270

This issue is related to how CodeMirror sees the text in source. Reloading CodeMirror after loading it fixes this issue.

MusikAnimal subscribed.

I suspect we introduced this regression with https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CodeMirror/+/776270. Thanks to ElijahPepe for coming up with a fix! I left some minor feedback on the patch; We'll make sure it goes out with this week's train, backporting if necessary.

Change 776270 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] Reload CodeMirror to fix a caret issue

https://gerrit.wikimedia.org/r/776270

Now deployed to all wikis. Thanks to everyone who helped with this!