Page MenuHomePhabricator

Links, images, tables, and citations added at top instead of position in WikiEditor when syntax highlighting is enabled (on Chrome only)
Closed, ResolvedPublicBUG REPORT

Description

Hello, there is a bug with link and image buttons of wiki editor in it.wikivoyage. Every time I want to add a link highlighting a word using link button (on top editor), the entire link appear not in the position I want but on top of thread. The same if you add an image using the button of editor. I see this happen only using "syntax highlighting" in source mode.

Steps

  1. Use Google Chrome (other browsers are possible?)
  2. Go to https://en.wikipedia.org/w/index.php?title=Sebastian_Mayer&action=edit with WikiEditor
  3. Click Syntax highlighting in editor toolbar to enable syntax highlighting
  4. Select any word
  5. Click add link item in editor toolbar
  6. Click Add collegemento button in dialog
  7. Line becomes on top, as expected.

Current

The link appears at the top, not instead of the selected fragment.

Expected

The link appears instead of the selected fragment.

Event Timeline

Aklapper changed the task status from Open to Stalled.Jun 5 2020, 8:03 PM
Aklapper removed a project: Persona-New-Editor.

Hi @Codas, thanks for taking the time to report this! Unfortunately this Wikimedia Phabricator task lacks some information.
If you have time and can still reproduce the situation: Please add a more complete description to this task. That should be

  • a full link to a web address where the issue can be seen.
  • a clear list of exact steps to reproduce the situation, step by step, so that nobody needs to guess or interpret how you performed each step,
  • what happens after performing these steps to reproduce,
  • what you expected to happen instead,
  • with which web browser(s) and web browser versions you have tested this.

In some situations it can also be helpful to know if you see the same behavior when you are not logged in, your web browser(s) and web browser version(s), your exact MediaWiki version (if it is not on a Wikimedia wiki) and PHP version, etc.

You can edit the task description by clicking Edit Task. Ideally, a good description should allow any other person to follow these steps (without having to interpret steps) and see the same results. Problems that others can reproduce can get fixed faster. Thanks!

@Aklapper before answer I need to ask you where I can find MediaWiki version and PHP version.

@Codas: It says "if it is not on a Wikimedia wiki". Italian Wikivoyage is a Wikimedia wiki.

  1. Firefox 77
  2. Go to https://it.wikivoyage.org/w/index.php?title=Ciampino&action=edit with WikiEditor
  3. Click Evidenziazione della sintassi in editor toolbar to enable syntax highlighting
  4. Highlight Roma in ::per la linea Roma-Albano
  5. Click third item (Collegamento) in editor toolbar to add link
  6. Click Inserisci collegemento button in dialog
  7. Line becomes ::per la linea [[Roma]]-Albano, as expected.

Cannot reproduce. Please provide a complete list of steps, step by step, if your results are different.

I can verify this bug. It's caused by MediaWiki-extensions-CodeMirror. I believe this is the same thing as what @kaldari is talking about here. on English Wikipedia.

Basically what happens is that if you've enabled syntax highlighting, clicking any of the toolbar item may insert the item at the beginning of the textarea instead of where your cursor is. Also (at least for me) it does not happen consistently. So sometimes it works (place item where your cursor is) and sometimes it doesn't ( place item at the beginning, disregarding cursor location)

Aklapper renamed this task from Bug with link and image buttons to Links and images added at top instead of position in WikiEditor when syntax highlighting is enabled.Jun 6 2020, 9:25 AM
Aklapper changed the task status from Stalled to Open.Jun 6 2020, 9:25 AM

Basically happen with Chrome (last version) but not with Safari 13.1.1. Nothing change if I'm logged or unlogged.

Hmm, this error is reproduced on all wikis. Chrome 83.0.4103.97.

Iniquity changed the subtype of this task from "Task" to "Bug Report".
Aklapper renamed this task from Links and images added at top instead of position in WikiEditor when syntax highlighting is enabled to Links and images added at top instead of position in WikiEditor when syntax highlighting is enabled (on Chrome only).Jun 8 2020, 1:42 PM
kaldari renamed this task from Links and images added at top instead of position in WikiEditor when syntax highlighting is enabled (on Chrome only) to Links, images, tables, and citations added at top instead of position in WikiEditor when syntax highlighting is enabled (on Chrome only).Jun 8 2020, 3:04 PM
kaldari triaged this task as High priority.

This seems to be caused by rEWED44e82ec08925: Restores focus after dialog closes, but I don't know why.

(Actually, I'm quite surprised that this worked correctly before, since the code there appears to handle just a plain textarea and not any of the alternative editors.)

Change 603558 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/WikiEditor@master] Use jQuery.textSelection API for compat with CodeMirror extension

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

Change 603558 merged by jenkins-bot:
[mediawiki/extensions/WikiEditor@master] Use jQuery.textSelection API for compat with CodeMirror extension

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

kaldari claimed this task.

I don't think either of them is related.