Last modified: 2014-10-09 21:23:15 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T70297, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 68297 - VisualEditor: Investigate parsing/rendering/behavior of "{{MW 1.23}}" on mediawiki.org [mini-tracking]
VisualEditor: Investigate parsing/rendering/behavior of "{{MW 1.23}}" on medi...
Status: RESOLVED FIXED
Product: VisualEditor
Classification: Unclassified
Data Model (Other open bugs)
unspecified
All All
: Normal major
: VE-deploy-2014-10-09
Assigned To: Roan Kattouw
:
Depends on: 58038 68862 68589 68708 68733
Blocks:
  Show dependency treegraph
 
Reported: 2014-07-20 15:55 UTC by Bartosz Dziewoński
Modified: 2014-10-09 21:23 UTC (History)
7 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Bartosz Dziewoński 2014-07-20 15:55:12 UTC
(This bug notes issues with both Parsoid and VisualEditor. I think all of this is caused by the terrible mistake that is bug 529 / bug 12974. I'll leave it for you to figure out this mess. :) )

----

On mediawiki.org, there is a family on fancy templates like [[mw:Template:MW 1.23]] that generate a right-floated MediaWiki version number in a frame.

These templates generate a wikitext table (starting with '{|'), which means that due to bug 529 / bug 12974 a newline is prepended before it. This behavior is incredibly annoying in practice, but it seems that we're very much wedded to it because it made Parsoid people's lives easier.

----

However, Parsoid rendering of this particular template is inconsistent with PHP. On [[mw:Manual:Skinning#Localisation_messages]], PHP generates an empty paragraph before the table, while Parsoid doesn't and produces an about-grouped pair of <span>\n</span><table>…</table> (the span tag only contains the prepended newline).

This rendering, that looks good in Parsoid/VisualEditor, therefore looks like crap in PHP parser.

Note that the <span> is not nested in a <p> or any other block-level element, it just sits there right in the <body>. (It is not visible since, as I mentioned, it just contains some whitespace.)

----

More problems appear when you try to edit text with this template in VisualEditor.

For example, testing on [[mw:Manual:Skinning#Localisation_messages]]:

* Place cursor before/after one of the templates.
* Press 'Right'/'Left' keyboard key twice.
** First press selects the template, as expected.
** Second press scrolls the page all the way up.

* Try inserting the "MW 1.23" template on an empty line.
** Observe that the blue highlights are different than for the
   templates already present on the page – there is both the table, as
   well as a single "space" (?) in text flow. Observe that the context
   menu is placed weirdly in the middle of the page.
** Place cursor after the "space" and try typing. Weird things happen,
   sometimes I get an exception "Uncaught Error: Unbalanced set of
   replace operations found", sometimes my input is duplicated or I
   get snowmen and pawns.
** Try deleting the template in any way. It is deleted, but the page
   is scrolled all the way up.

* Edit the two paragraphs right after the "Localisation messages"
  heading (add a letter somewhere in the middle or something).
* Try saving the page.
** Observe that multiple newline-related changes appear to have been
   made. Strangely, there are actually no changes, but the *before*
   half of the comparison has some newlines removed.
Comment 1 Bartosz Dziewoński 2014-07-23 11:36:19 UTC
This is causing breakage in edits (that is not being detected by VE):
https://www.mediawiki.org/w/index.php?title=Manual:Skinning&diff=1074312&oldid=1072136
Comment 2 Alex Monk 2014-07-26 00:17:49 UTC
(In reply to Bartosz Dziewoński from comment #0)
> * Place cursor before/after one of the templates.
> * Press 'Right'/'Left' keyboard key twice.
> ** First press selects the template, as expected.
> ** Second press scrolls the page all the way up.

So if you select a node that's floating right and is half way down the page, then press left or right, you scroll all the way to the top of the page (though the cursor is positioned correctly).

> ** Place cursor after the "space" and try typing. Weird things happen,
>    sometimes I get an exception "Uncaught Error: Unbalanced set of
>    replace operations found", sometimes my input is duplicated or I
>    get snowmen and pawns.

Yeah, I get that error and other weirdness (e.g. the cursor moving around - to before/after the template I think?) when typing normally, then snowmen+pawns when I try to undo/redo things. I've also been getting some extra errors: Uncaught Error: Unbalanced input passed to document 
At one point I got this error as well: Uncaught Error: Offset could not be translated to a DOM element and offset: 77
Comment 3 Roan Kattouw 2014-07-28 19:42:19 UTC
The pawn, snowman and offset exception bugs should be fixed by https://gerrit.wikimedia.org/r/149920 .

The scrolling all the way up is bug 68589.

The rendering weirdness due to the span-wrapped newline is probably unique to this bug.
Comment 4 Bartosz Dziewoński 2014-07-30 15:46:45 UTC
Let's turn this into a mini tracking bug, then? I split off the Parsoid issue to bug 68862, together with VE bug 68733, bug 68708 and bug 58038 this seems to describe all of the problems.
Comment 5 James Forrester 2014-10-09 21:23:15 UTC
All VE items appear fixed as of a while ago. Marking as such.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links