Page MenuHomePhabricator

Cursor position is out of sync in DiscussionTools with CodeMirror
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Use Reply in a discussion with CodeMirror beta feature enabled on mobile

What happens?:

  • Every time spacebar is pressed, the cursor advances one additional space past the text. When the cursor is put back anywhere within the typed text, new edits do not happen where the cursor is shown. See attached screen recording.

Other information (browser name/version, screenshots, etc.):
Firefox for Android and Chrome for Android with advanced syntax highlighting turned on.

Gboard virtual keyboard on Pixel 10

Event Timeline

I have the same issue. This happens with every character and not only space.

I have the same issue. This happens with every character and not only space.

Are you also using Android? I cannot reproduce it on iOS.

I have the same issue. This happens with every character and not only space.

Are you also using Android? I cannot reproduce it on iOS.

Yes Android

I tested more, and the issue is related to font size. The problem doesn't actually lie with the cursor, which is correctly displayed considering the expected text size, but with the text size which is always small in the form. It only occurs with medium and big font size.

  • Big font size with beta feature enabled:

Screenshot_2025-12-09-18-21-10-195_com.opera.browser.jpg (2×1 px, 386 KB)

  • Small font size with beta feature enabled:

Screenshot_2025-12-09-18-22-11-641_com.opera.browser.jpg (2×1 px, 409 KB)

  • Big font size with beta feature disbled:

Screenshot_2025-12-09-18-29-45-077_com.opera.browser.jpg (2×1 px, 392 KB)

Yeah, it has to do with the font size choice. The cursor shift is most pronounced when a space is typed in.
In Chrome, when the first word is followed by a space, the word is shown in two sizes. That can be undone by typing in a backspace.

There is a conflict between MobileFrontend and MinervaNeue styles in VisualEditor-MediaWiki-2017WikitextEditor. .mf-font-size-clientpref-regular .content p from MobileFrontend enlarges the font size of the hidden VE surface, while .cm-editor .cm-scroller from MinvervaNeue specifies the font size of the CM6 content.

Change #1216878 had a related patch set uploaded (by Bhsd; author: Bhsd):

[mediawiki/skins/MinervaNeue@master] Explicitly set font size in VisualEditor with CodeMirror 6 enabled

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

Change #1217489 had a related patch set uploaded (by Prakhar0804; author: Prakhar0804):

[mediawiki/extensions/CodeMirror@master] Fix cursor position sync in DiscussionTools mobile overlay (T412117)

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

Change #1216878 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@master] Explicitly set font size in VisualEditor with CodeMirror 6 enabled

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

MusikAnimal changed the task status from Open to In Progress.Dec 16 2025, 12:50 AM

Should go live with this week's train.