Page MenuHomePhabricator

Copying multiple categories from the bottom of Wikipedia articles and pasting them into source editor (while logged in) breaks all pasting until you switch editors
Open, Needs TriagePublicBUG REPORT

Description

This may seem like a minor inconvenience bug but I don't know what is actually broken with this bug and whether it extends to further areas.

Steps to reproduce:

  1. Be logged in (such that pasting formatting into the source editor prompts it to ask you if you want to convert it to wikitext).
  1. Find any Wikipedia article with at least 2 categories listed at the bottom.
  1. Select the categories such that the gap between 2 categories is included in the selection.

  1. Find any other page on Wikipedia (not other Wikimedia projects).
  1. Edit the page in source mode and paste your selection at the end of a line (including a blank line), not in the middle of words, such as here:

The following should come up:

  1. It doesn't matter what button you click. Click either.

Actual results:

Nothing is pasted, and pasting is now broken. You can copy anything at all and it won't be able to be pasted into that source editor.
You can fix this by switching to visual editor and switching back again.

Expected results:

The category text should be pasted either without any spaces or new lines or with spaces or new lines between each category, as it is in other input boxes. Pasting ability should be intact.

Notes:

According to Notepad or online Unicode identifiers, there is no character between the categories (other than new lines or spaces). But according to Wikimedia projects other than Wikipedia (like Wiktionary or Wikimedia Commons), where it is possible to paste this text and have pasting remain intact, there is an unknown space character between the categories which appears on each new line. Copying and pasting this character anywhere is impossible, as it's not a real character but a glitch. Selecting it with Shift-Arrows also causes the text style to change to blank:

Details

Related Gerrit Patches:
mediawiki/extensions/VisualEditor : masterUpdate VE core submodule to master (eb68d80cb)
VisualEditor/VisualEditor : masterve.ce.Surface: Fix copy-pasting `display: inline` lists into NWE

Event Timeline

SUM1 created this task.Dec 1 2019, 10:04 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 1 2019, 10:04 PM
SUM1 renamed this task from Copying multiple categories from the bottom of articles and pasting them into source editor (while logged in) breaks all pasting until you switch editors to Copying multiple categories from the bottom of Wikipedia articles and pasting them into source editor (while logged in) breaks all pasting until you switch editors.Dec 1 2019, 10:05 PM
SUM1 updated the task description. (Show Details)
Schnark added a subscriber: Schnark.Dec 2 2019, 9:55 AM

This works for me without any issues, both with the HotCat gadget enabled (as seen on the screenshots) and without it.

@SUM1: Which exact Wikipedia website is this about?

SUM1 added a comment.Dec 2 2019, 6:43 PM

@SUM1: Which exact Wikipedia website is this about?

https://en.wikipedia.org

SUM1 added a comment.EditedDec 2 2019, 6:47 PM

This works for me without any issues, both with the HotCat gadget enabled (as seen on the screenshots) and without it.

Well I just tried it in a clean Chrome Canary. It still happened, but less reliably. Sometimes it took 1 try of pasting, sometimes it took 5. But most times it still happened.* And yes, even with HotCat disabled.

*Edit: I figured out the rule: it was happening when I pasted the selection at the end of a line (including a blank line) but not when I pasted it in the middle of words or characters.

Pasting here causes the glitch.

Pasting here does not.

It happens the same way in Firefox too.

SUM1 updated the task description. (Show Details)Dec 2 2019, 6:56 PM
SUM1 updated the task description. (Show Details)Dec 2 2019, 6:58 PM
matmarex added a subscriber: matmarex.

I can reproduce this. The list of categories is a <ul>/<li> list, but styled using CSS to display as plain text. Apparently when you copy-paste it, you end up with <li> nodes without the parent <ul> node, which breaks assumptions in our Converter code and blows up.

JTannerWMF added a subscriber: JTannerWMF.

The priority of this is dependent upon the decision we make surrounding what editing interface we use for the OWC2020 work.

Actual results:
Nothing is pasted, and pasting is now broken. You can copy anything at all and it won't be able to be pasted into that source editor.
You can fix this by switching to visual editor and switching back again.

This was partially fixed by rGVEDd39e1506441b: Allow the afterPaste promise to reject, and pasting doesn't break permanently anymore, but still nothing is pasted.

Minimal test case for reproducing this:

<ul>
	<li>A</li>
	<li>B</li>
	<li>C</li>
	<li>D</li>
</ul>
<style>
ul { display: inline; }
</style>

Open this in your browser, the select from B to C and copy-paste into NWE. (If you select the entire list, the bug might not happen.)

Ryasmeen added a subscriber: Ryasmeen.

Still broken, error in the console:

Uncaught Error: DocumentNodes do not exist in the linear model

See the screenshot attached:

We forgot to make the submodule update for this change (as usual) before asking for QA, which means it wasn't live on Beta yet.

Change 565413 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (eb68d80cb)

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

Change 565413 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (eb68d80cb)

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

@matmarex: I am not getting the error anymore and also getting that dialog that asks for converting to wikitext. So that's good. But after pasting and converting it to wikitext, the categories are appearing as bullet items. Is that expected?

See the screenshot:

Yeah, pretty much. When copying from read mode, we don't have any "semantic" information that these are categories, it just looks like a list of links. And when you paste into a different site (I assume you copied from https://en.wikipedia.org/ to https://en.wikipedia.beta.wmflabs.org/), the links are treated as external and they are removed due to T196715, so all that's left is a plain list.

Yeah, pretty much. When copying from read mode, we don't have any "semantic" information that these are categories, it just looks like a list of links. And when you paste into a different site (I assume you copied from https://en.wikipedia.org/ to https://en.wikipedia.beta.wmflabs.org/), the links are treated as external and they are removed due to T196715, so all that's left is a plain list.

@matmarex: okay..I copied from a page on https://en.wikipedia.beta.wmflabs.org to another page on the same environment.

Hmm, so apparently that happens when the links are redlinks (the category page doesn't exist). Can you file a separate task about that? (I don't think that's a very important bug, to be honest, but it is a bug…)