Page MenuHomePhabricator

Offsets calculated incorrectly with inline images in MediaWiki
Closed, ResolvedPublic8 Estimated Story Points

Description

As reported at https://en.wikipedia.org/wiki/Wikipedia:VisualEditor/Feedback#Can.27t_type_because_it_switches_characters , try and VEdit the table at https://en.wikipedia.org/w/index.php?title=List_of_predecessors_of_sovereign_states_in_North_America&veaction=edit . For example, where it says "Colony of Antigua (1671–1816; 1833–1958) (part of British Leeward Islands)", try to add something after Islands, then hit Enter. See how the word is now in a new position, part of (in other cases, label for) the previous wikilink.

Event Timeline

Deskana moved this task from To Triage to TR0: Interrupt on the VisualEditor board.
Deskana subscribed.

This needs investigation.

Can reproduce locally with the following cut-down test case:

{| class="wikitable"
|-
! Sovereign state
! Predecessors
|-
| [[Antigua and Barbuda]]
| [[File:Flag of Leeward Islands 1871-1956.gif|24px]] [[History of Antigua and Barbuda#European colonization|Colony of Antigua]] (1671–1816; 1833–1958) ''(part of [[British Leeward Islands]])''<br/>[[File:Flag of Leeward Islands 1871-1956.gif|24px]] [[History of Antigua and Barbuda#European colonization|Colony of Barbuda]]
|}
== See also ==

When I type "foo" before the close paren, the *model* shows the insertion as occurring inside the link, although it shows up "as expected" outside the link... until you hit enter. After you hit enter, the model and the view are in sync again. And in fact if you then Ctrl-Z undo, the view stays in sync with the model as your typing is undone.

(Looks like a pure VE bug, no Parsoid involvement.)

Thanks, @cscott ! I've put this at the top of the column, so we get to it sooner.

This seems to be happening outside tables as well? Check this diff - in particular what happened when I changed Queensland to Maryland in both target and label, and July 2014 to July 2017. This is probably UBN at this point. Related thread at en.wp.

Deskana raised the priority of this task from High to Unbreak Now!.Jun 22 2017, 5:09 PM

This is potentially very bad wikitext corruption that needs urgent investigation.

Looks like some issues with view/model cursor offsets in CE code. I get an exception as soon as I double click on the table cell. (that was with TOC enabled) Pinging @dchan.

The problem appears to be caused by the inline image - I imagine it is not getting counted properly during offset conversion. Simply cursoring off the image to the right jumps you an extra two places.

Minimal wikitext:

Inline [[File:Flag_of_Leeward_Islands_1871-1956.gif|24x24px]] image
Esanders renamed this task from Text added in table gets mingled with wikilinks to Offsets calculated incorrectly with inline images in MediaWiki.Jun 22 2017, 7:33 PM

Change 360907 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/VisualEditor@master] Ensure MWInlineImage's get the ve-ce-leafNode class

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

Change 360911 had a related patch set uploaded (by Esanders; owner: Esanders):
[VisualEditor/VisualEditor@master] Use instanceof to check for LeafNode's

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

Brijpallal renamed this task from Offsets calculated incorrectly with inline images in MediaWiki to Office 365 2013 +1-800-492-3958 customer service help desk number.Jun 26 2017, 10:51 PM
Brijpallal lowered the priority of this task from Unbreak Now! to High.
Brijpallal updated the task description. (Show Details)
Brijpallal removed a subscriber: gerritbot.
Jay8g renamed this task from Office 365 2013 +1-800-492-3958 customer service help desk number to Offsets calculated incorrectly with inline images in MediaWiki.Jun 27 2017, 4:51 AM
Jay8g updated the task description. (Show Details)
Aklapper raised the priority of this task from High to Unbreak Now!.Jun 27 2017, 10:47 AM

Change 360911 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] ce.TextState#getChunks: Use instanceof to check for LeafNodes

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

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

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

Change 360907 merged by Jforrester:
[mediawiki/extensions/VisualEditor@master] Ensure MWInlineImages get the ve-ce-leafNode class

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

Change 361683 merged by Jforrester:
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (b3ce1967f)

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