Page MenuHomePhabricator

After inserting wiki markup via Charinsert, cursor position always goes to beginning of line when syntax highlighting is enabled
Closed, ResolvedPublic

Description

Steps

  1. Use Google Chrome (latest version) or Internet Explorer (latest version) or Firefox (latest version)
  2. Go to https://it.wikivoyage.org/w/index.php?title=Turks_e_Caicos&action=edit
  3. Click Syntax highlighting in editor toolbar to enable syntax highlighting
  4. Select any plain word
  5. Click any Wiki markup in the below edit tools area, for example "[[]]"
  6. The plain word became a wikilink, as expected.

Current

After inserting the wiki markup the cursor is positioned at the beginning of the line

Expected

After inserting the wiki markup the cursor shell be positioned (as previously) after the markup.

Notes

It can be tested with any project and/or language, because it affects ALL WIKIS

Second case

If the markup is pressed without selecting any plain word, the cursor goes at the beginning of the line instead of being inside the markup.

Event Timeline

Use Google Chrome

Please always provide version information - thanks!

The lastest

Use Google Chrome

Please always provide version information - thanks!

Done. Since it affects all wikis, all languages, with the main browsers I would increase the priority

The lastest

@Andyrom75: That does not mean much when looking at this ticket in a few weeks, or given that different Linux distributions may ship different packages/versions.
Please always include version numbers - they exist for a reason. :)

You are right, but my point is another. If all the three major browsers experience suddenly the same issue, maybe the version is not relevant, and the bug has been introduced in a recent code update.
Furthermore, since it affects ALL the wikis in ALL the languages, I hope that someone would start working on it soon before any browser version would change ;-)
By the way:

  • Chrome 85.0.4183.102
  • Firefox 80.0.1
  • IE 11.508.19041.0

The issue occurs also with Safari on smartphone (I'm not able to determine its version)

@Aklapper this task still needs triage, could you support?

Aklapper renamed this task from Charinsert links do not position the cursor correctly when syntax highlighting is enabled to After inserting wiki markup via Charinsert, cursor position always goes to beginning of line when syntax highlighting is enabled.Oct 12 2020, 5:07 AM

@Aklapper this task still needs triage, could you support?

@Andyrom75: What to "support" exactly? The task is unprioritized ("Open, Needs Triage") which is common, and anyone is welcome to work on fixing this or not. :)

@Aklapper could you help me to find out who works recently on Charinsert? Maybe they can check this out easier than other users.

According to https://www.mediawiki.org/wiki/Editing_team you (@Whatamidoing-WMF , @JTannerWMF, @MFlorence, @Esanders, @iamjessklein, @Ryasmeen, @dchan, @DLynch, @matmarex, @Mvolz, @MNeisler, @ppelberg ) are the team in charge of CharInsert tool.
I'm disturbing you since I've seen in the https://www.mediawiki.org/wiki/Developers/Maintainers page that there is no maintainers associated to CharInsert.

Any suggestion on who I may contact to fix this recent issue?

I'll spare everyone else the notifications… In the future, you can probably just disturb @ppelberg and he'll disturb one of us ;)

There have been no recent changes to CharInsert, it's a very dead project (or, you could say, very feature-complete).

The latest change in CodeMirror (the syntax highlighting tool) was https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CodeMirror/+/587239 in July. I was hoping this would be the cause (then we could just revert it), but unfortunately it seems it is not:

That patch was merged in 1.36.0-wmf.1, so I tested the previous version 1.35.0-wmf.41 to see if it works.

So it looked like a good suspect, but this seems to have been just a sheer stroke of luck, because 1.35.0-wmf.41 with the suspicious patch applies still works correctly.

So, I guess one of the other patches in https://www.mediawiki.org/wiki/MediaWiki_1.36/wmf.1 must be the cause of the problem… (or I'm testing it wrong).

I'm not sure what's worse, debugging this (text selection issues are super annoying to work with, because every time you switch to the debugger, it messes with keyboard focus), or just guessing and testing a bunch of patches from that huge list.

@matmarex thanks for your high level screeening. Unfortunately I'm not able to support you on debugging, so I just limit myself to share one consideration.

Is it possible for you to test a group of patches at the same time, instead of one by one? In the affirmative case, you can have a dichotomy approach to shorten the time to find the wrong patch.

Is it possible for you to test a group of patches at the same time, instead of one by one? In the affirmative case, you can have a dichotomy approach to shorten the time to find the wrong patch.

Yes, usually one could even mostly automate that process with git-bisect, but in this case we don't know in which repository lies the problem, which adds some manual work. Might be easier to guess and test :)

sob...
I've looked into https://www.mediawiki.org/wiki/MediaWiki_1.36/wmf.1 more for curiosity than for expertise.
May CodeEditor or WikiEditor repository affect CharInsert? My guess is because I experience the problem during edit phase.

@matmarex AFAYK there is an easy way (e.g. web interface) to test a specific version with/without certain patches? I'll be glad to spend time on trying to find which is the patch that causes this problem to save your debug time, because editing an article in this way is very annoying. Once found, clearly I need someone else support to fix it :-)

Andyrom75 triaged this task as Medium priority.Nov 6 2020, 7:26 AM
Andyrom75 updated the task description. (Show Details)

This problem affect ALL wikis, I'll be glad to support on debugging, I just @matmarex feedback on how to test "a version + a set of patch" to find the one that caused the problem.

@matmarex I don't know if it can help with the debug, but I've noticed this different behavior in the following two situations:

Scenario A - Normal user actions sequence
actions

  • focus on text edit box
  • click on Charinsert markup

effect

  • markup shown in the current cursor position OK
  • cursor position moved at the line beginning NOT OK

Scenario B - Abnormal actions sequence with the introduction of a trick/workaround
actions

  • focus on text edit box
  • click somewhere outside the editbox TRICK
  • click on Charinsert markup

effect

  • markup shown in the current cursor position OK
  • cursor position according to the rules of the inserted markup OK

I don't know if this different behavior can suggest which is the specific module that introduce this bug.

I've test it on it:voy, en:voy, it:w and en:w and now It seems that the issue has been solved.

Could you double check, confirm and eventually close the ticket?

If the reporter cannot reproduce then let's close. (If you cannoty reproduce then in the future please always include browser and browser version information (assuming that you updated your computer in the last three months); cannot reproduce the problem here on Chromium 87.0.4280.88)

All the three browsers I've previously mentioned worked correctly, so it's not a matter of their improvement, but a WMF patch has been delivered.
I was curious to know what solved the problem before closing the ticket.

So technically is not declined but resolved.

Andyrom75 changed the task status from Declined to Resolved.Dec 18 2020, 3:14 PM
Aklapper changed the task status from Resolved to Declined.Dec 18 2020, 4:28 PM

Resetting status as this might have been a fix in some browser software instead. Nobody knows.

Aklapper changed the task status from Declined to Resolved.Dec 18 2020, 4:29 PM

Oh, both Firefox and Chromium - sorry I missed that. In that case, you are probably right. (Sorry for the noise.)

No problem @Aklapper , for completeness, also IE works fine now.
As said above, it would have been good to know what fixed the problem, to avoid the same issue in the future, or at least to fix it in less time.

@Andyrom75 I was curious to find out myself, so I looked at the changes just before 18 December (when you said it was fixed), and I confirmed that this was fixed by the patch https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CodeMirror/+/644518 "Update CodeMirror to 5.58.3" from 10 December.

This still doesn't tell us exactly how it was fixed, because the change log is 500 lines long ;), but I'm not really willing to dig any further. https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CodeMirror/+/644518/4/resources/lib/codemirror/CHANGELOG.md

Thanks @matmarex, I think it's enough. At least, in the unlikely case that it would happen again, we know where to look.