Page MenuHomePhabricator

Visual Editor: deleting selected text not working
Closed, ResolvedPublic

Description

I've hit this bug a few times today.

Try to edit [[Woodgate, Queensland]]. I want to move the second sentence in the lede para and its citation ( "At the 2011 census, Woodgate had a population of 941, up from 758 recorded at the 2006 census.[1]") to the History section. I select the text and citation and it is highlighted (good). Then I do either Cut from right-click or CTRL-X via keyboard (either way makes no difference) and nothing is deleted (odd?) so I go to click in the History section in preparation to Paste and discover that I can't click there. Any attempt to relocate my cursor in the article just makes the selected text in the lede flash at me. At this stage, pretty much all I can do is exit the editor.

I tried to be creative. Go back into VE and select the sentence as before and then Copy. Click in History and paste. Good that worked. Now back to the lede para to select the sentence I no longer need there (works) and then hit Backspace to delete it (fails). But if I now position my cursor after the content and use Backspace many times I can delete the content lettter by letter (the citation counting as one letter for this purpose).

Initially I thought it might have something to do with the citation at the end of the selected text, but I found I could cut-and-paste selections involving a citation in other parts of the same article. I have looked at the source code of that sentence to see if there was some weird syntax present but it looks as it should.

Event Timeline

I probably should add that I was reporting relative to [https://en.wikipedia.org/w/index.php?title=Woodgate,_Queensland&oldid=922128021 this version of the articles]. I have subsequently edited it (but it doesn't seem to have altered the problem).

Hi, can you please provide a list of clear steps to reproduce, plus browser information and browser version? Thanks.

I can reproduce using the steps given. This sounds similar to T234489: Problems with deleting/cutting/moving references in VisualEditor, apparently there are some cases where it is still broken.

I can reproduce the problem on https://en.wikipedia.org/w/index.php?title=Woodgate,_Queensland&oldid=922128021 using Chrome 77.0.3865.120/Windows 7. When trying to cut the second sentence of the intro section, it doesn't work and the javascript console reports the error

load.php?lang=en&modules=ext.visualEditor.core&skin=vector&version=bcyio:145 Uncaught Error: Remover and inserter unexpectedly diverged

at VeDmTreeModifier.ve.dm.TreeModifier.processRetain (load.php?lang=en&modules=ext.visualEditor.core&skin=vector&version=bcyio:145)
at VeDmTreeModifier.ve.dm.TreeModifier.processLinearOperation (load.php?lang=en&modules=ext.visualEditor.core&skin=vector&version=bcyio:143)
at VeDmTreeModifier.ve.dm.TreeModifier.calculateTreeOperations (load.php?lang=en&modules=ext.visualEditor.core&skin=vector&version=bcyio:143)
at VeDmTreeModifier.ve.dm.TreeModifier.process (load.php?lang=en&modules=ext.visualEditor.core&skin=vector&version=bcyio:142)
at VeDmTransactionProcessor.ve.dm.TransactionProcessor.process (load.php?lang=en&modules=ext.visualEditor.core&skin=vector&version=bcyio:88)
at VeDmDocument.ve.dm.Document.commit (load.php?lang=en&modules=ext.visualEditor.core&skin=vector&version=bcyio:209)
at VeDmSurface.ve.dm.Surface.changeInternal (load.php?lang=en&modules=ext.visualEditor.core&skin=vector&version=bcyio:171)
at VeDmSurface.ve.dm.Surface.change (load.php?lang=en&modules=ext.visualEditor.core&skin=vector&version=bcyio:170)
at VeDmSurfaceFragment.ve.dm.SurfaceFragment.change (load.php?lang=en&modules=ext.visualEditor.core&skin=vector&version=bcyio:180)
at VeDmSurfaceFragment.ve.dm.SurfaceFragment.delete (load.php?lang=en&modules=ext.visualEditor.core&skin=vector&version=bcyio:193)

The issue has to do with the template "{{CensusAU|2006}}" that appears just before the reference at the end of the text which we are trying to cut. If I use the source code editor to replace this template with the text "2006" and then switch back to VisualEditor, the sentence can be cut properly.

Possibly related: In VE if I select the text "Australia.[1] " at the end of the first sentence (including the space after the reference!), it cannot be cut and gives the same error message. Including one more character in the selection, or removing the trailing space from the selection, does not give the bug.

Change 544568 had a related patch set uploaded (by Divec; owner: Divec):
[VisualEditor/VisualEditor@master] TreeModifier: Ignore removed nodes properly when normalizing from a text node

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

Thanks @Kerry_Raymond !

Technical details for triage: this is triggered if a transaction contains a removal starting in the interior of a text node, crosses an inline element, and moves immediately into another text node, and then is followed by a subsequent retain and removal. See the patch set above for a minimal example.

The template does indeed seem to be the trouble maker. I just had the same problem on [https://en.wikipedia.org/w/index.php?title=Kia_Ora,_Queensland&oldid=922291754 Kia Ora, Queensland] when I tried to cut-and-paste "It is located at 2754 Anderleigh Rd (26.02817°S 152.77676°E).[5]" where the coords are produced by a template. Another test case for you.

Yes that looks like the same pattern – thanks for the additional info!

Change 544568 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] TreeModifier: Ignore removed nodes properly when normalizing from a text node

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

Change 543685 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (b2939de73)

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

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

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

Change 544901 had a related patch set uploaded (by Bartosz Dziewoński; owner: Divec):
[VisualEditor/VisualEditor@REL1_34] TreeModifier: Ignore removed nodes properly when normalizing from a text node

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

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

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

Change 544901 merged by jenkins-bot:
[VisualEditor/VisualEditor@REL1_34] TreeModifier: Ignore removed nodes properly when normalizing from a text node

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

Change 544902 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@REL1_34] Update VE core submodule to d3e22619d7

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

Change 544915 had a related patch set uploaded (by Bartosz Dziewoński; owner: Divec):
[VisualEditor/VisualEditor@wmf/1.35.0-wmf.1] TreeModifier: Ignore removed nodes properly when normalizing from a text node

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

Change 544916 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@wmf/1.35.0-wmf.1] Update VE core submodule to a98c346bb2

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

Change 544917 had a related patch set uploaded (by Bartosz Dziewoński; owner: Divec):
[VisualEditor/VisualEditor@wmf/1.35.0-wmf.2] TreeModifier: Ignore removed nodes properly when normalizing from a text node

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

Change 544918 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@wmf/1.35.0-wmf.2] Update VE core submodule to a4ab456dc0

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

Change 544917 merged by jenkins-bot:
[VisualEditor/VisualEditor@wmf/1.35.0-wmf.2] TreeModifier: Ignore removed nodes properly when normalizing from a text node

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

Change 544915 merged by jenkins-bot:
[VisualEditor/VisualEditor@wmf/1.35.0-wmf.1] TreeModifier: Ignore removed nodes properly when normalizing from a text node

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

Change 544916 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@wmf/1.35.0-wmf.1] Update VE core submodule to a98c346bb2

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

Mentioned in SAL (#wikimedia-operations) [2019-10-21T17:08:06Z] <jforrester@deploy1001> Synchronized php-1.35.0-wmf.1/extensions/VisualEditor/: Update VisualEditor for set of back-ports in wmf.1 T233320, T234564, T235959 (duration: 00m 56s)

Change 544918 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@wmf/1.35.0-wmf.2] Update VE core submodule to a4ab456dc0

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

Mentioned in SAL (#wikimedia-operations) [2019-10-21T18:41:29Z] <urbanecm@deploy1001> Synchronized php-1.35.0-wmf.2/extensions/VisualEditor: SWAT: a4ab456: TreeModifier: Ignore removed nodes properly when normalizing from a text node (T235959); rEVEDecb453238265: Update VE core submodule to a4ab456dc0 (T235959); rEVEDa850cee49807: ApiVisualEditor: Always return etag with content (T233320) (duration: 00m 55s)

Mentioned in SAL (#wikimedia-operations) [2019-10-21T18:41:29Z] <urbanecm@deploy1001> Synchronized php-1.35.0-wmf.2/extensions/VisualEditor: SWAT: a4ab456: TreeModifier: Ignore removed nodes properly when normalizing from a text node (T235959); rEVEDecb453238265: Update VE core submodule to a4ab456dc0 (T235959); rEVEDa850cee49807: ApiVisualEditor: Always return etag with content (T233320) (duration: 00m 55s)

This should be resolved on all Wikimedia wikis now.

ppelberg claimed this task.