Page MenuHomePhabricator

Press backspace to remove a space before a colon make any chars typed then not considered while publishing
Closed, ResolvedPublic

Description

I’m proud to finally have achieved to find a way to reproduce a bug which drove me crazy many times! ^^

  1. Using Firefox, edit with visual editor a page which contains a colon following a space like this: words : other words (you may use random article on fr.wp, they almost all contains :)
  2. Put your cursor after the space.
  3. Press backspace key on your keyboard until the space is removed (only once if you put your cursor between the space and the colon).
  4. Type anything (except Carriage Return)
  5. Try to save: what you typed in previous step is not saved. (You can only Review your changes in wikitext, the text doesn’t appear too).

This bug doesn’t appear with Chromium.
It doesn’t appear with other characters than colon (I have tried ? and ! which both generate   before them as : do.)
It doesn’t appear if you remove the space using Del key.

Details

Event Timeline

I can reproduce this. Example test page: https://fr.wikipedia.org/wiki/Avant_et..._après?veaction=edit

Wikitext markup like this:

Scénario : Max Linder

Is represented like this in Parsoid HTML:

Scénario<span typeof="mw:DisplaySpace mw:Placeholder" id="mwEg">&nbsp;</span>: Max Linder
Why? When parsing wikitext to HTML, Parsoid (and the old parser) converts a space before a colon to a non-breaking space (this behavior is known as "French spaces", and also happens with some other punctuation, not just colons). After you edit the page in VE, when converting the HTML back to wikitext, this non-breaking space would be rendered as &nbsp; in the source code. To prevent this, the additional markup around it is added and handled in a special way.

If any content ends up inside this <span> tag, it is lost, the tag is always converted back to just a space in wikitext.

I searched Phabricator for 'mw:DisplaySpace' to see if this was reported before, and instead found T94509, where (in 2015) we apparently agreed on how this should be handled by VisualEditor but that was never actually implemented.

Change 562663 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] Add handling for mw:DisplaySpace

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

Change 562663 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Add handling for mw:DisplaySpace

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