Page MenuHomePhabricator

Spaces at the start of a paragraph aren't very obvious
Closed, ResolvedPublic8 Estimated Story Points

Description

It is possible (if inadvisable) to have whitespace at the start of a paragraph in HTML; to readers it is mostly invisible. In MediaWiki, because whitespace at the start of a paragraph has magic meaning, Parsoid <nowiki />s it. To avoid users doing this accidentally, it might be nice to design a way to flag to the user what they've done when they create these.

Details

Reference
bz66628

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:11 AM
bzimport set Reference to bz66628.

Created attachment 15656
Nowiki tags enclose spaces, but no spaces are shown in VisualEditor

Attached:

Nowiki_Screen_Shot_2014-06-14_at_3.58.41_PM.png (342×946 px, 124 KB)

They actually are shown – but it's very hard to see them. Re-wording.

No, they actually are not shown.

Download the screenshot and pull it into Preview on your Mac. Zoom in six times, scroll way over to the red ovals, and use "Tools:Annotate:Line" to draw a vertical line down the leading edge of those paragraphs. Hold down your shift key to keep the line straight. Set the line to the thinnest option in the toolbar.

Now count the pixels between your line and the beginnings of each letter on those paragraphs. The straight edge on the 'r' of 'raised', the 'E' of 'Experience', and the 'M' of 'Modern' are very convenient for this.

There is no visible difference. Where I drew my line, I found exactly one pixel between my line and the start of each character. Something that does not display as even a single pixel on a reasonably typical laptop is properly described as "not shown".

This is still happening. I'm still not doing anything exceptional: I put my cursor in between two sentences and press the Return key. This still should not be happening. If I want to start a paragraph with a space, then I should have to actually press the space bar.

https://en.wikipedia.org/w/index.php?diff=prev&oldid=641792115

I'm adding Parsoid to this, because Subbu thought that it might be solvable there.

gpaumier set Security to None.

The nowikied space also persists if a user then removes the newline. See https://en.wikipedia.org/w/index.php?diff=653301980 for an example in which:

  • an existing nowikied space at the beginning of a paragraph now lives in the middle of a paragraph;
  • a new nowikied space was added at the beginning of a paragraph.

Are there any valid use cases for keeping those white spaces at the beginning of a paragraph? Otherwise I think we should just remove them. If we don't want to remove them automatically on save, then as @Whatamidoing-WMF suggested in T68628#967908 , we should at least remove the space when editing, so that the nowikied space is added only if the user explicitly inserts it.

This comment was removed by gpaumier.
gpaumier renamed this task from VisualEditor: Spaces at the start of a paragraph aren't very obvious to Remove nowikied spaces at the beginning of a paragraph unless the user manually inserted them.Mar 24 2015, 10:44 PM
gpaumier updated the task description. (Show Details)
Jdforrester-WMF renamed this task from Remove nowikied spaces at the beginning of a paragraph unless the user manually inserted them to Spaces at the start of a paragraph aren't very obvious.EditedMar 25 2015, 7:33 PM

Are there any valid use cases for keeping those white spaces at the beginning of a paragraph? Otherwise I think we should just remove them. If we don't want to remove them automatically on save, then as @Whatamidoing-WMF suggested in T68628#967908 , we should at least remove the space when editing, so that the nowikied space is added only if the user explicitly inserts it.

I have reverted the title change because it is completely wrong. "Remove nowikied spaces at the beginning of a paragraph unless the user manually inserted them" means "please corrupt pages on load", and is absolutely the wrong this to do. VisualEditor is not in the business of "fixing" pages. If you click edit, then click save without making changes, there should never ever be any difference, or we've failed.

This appears to be fixed now (same browser/same article test).

I think that a title of "Stop adding nowiki'd spaces at the start of newly
split paragraphs" would capture the ask better. I don't really want to see
the spaces (although that would be better than having them present but
invisible); I want the stray spaces to not be present in the first place.

This appears to be fixed now (same browser/same article test).

I think that a title of "Stop adding nowiki'd spaces at the start of newly
split paragraphs" would capture the ask better. I don't really want to see
the spaces (although that would be better than having them present but
invisible); I want the stray spaces to not be present in the first place.

That's a different task, which I have created: T93935: When splitting a paragraph, trim whitespace from the start of the new one.

I've restored this task back to what it's about, which is a design issue about discouraging odd user behaviour, and has essentially nothing to do with <nowiki />s, which are already dealt with in multiple other tasks.

I'm having second thoughts about my earlier all-clear. It's possible that this problem only arises if the wikitext uses French spacing (two spaces after the full stop). If that's the case—if it strips one space but leaves the second—then my test yesterday is inadequate, because I didn't check what the wikitext looks like.

I have reverted the title change because it is completely wrong. "Remove nowikied spaces at the beginning of a paragraph unless the user manually inserted them" means "please corrupt pages on load", and is absolutely the wrong this to do. VisualEditor is not in the business of "fixing" pages. If you click edit, then click save without making changes, there should never ever be any difference, or we've failed.

That's not at all what I meant. I didn't suggest we fix unrelated spaces; I thought the accompanying description (which you moved to T93935) made that clear. Sorry for the misunderstanding.

@Jdforrester-WMF by the way, was this officially rejected as blocker, or was the blocker tag removed for another reason?

T78137: Leading white spaces should be highlighted and converted to &nbsp; or something sounds like an interesting approach.

I tested now and it seems like the leading spaces can still be created and displayed in the editor, but magically disappear when the MediaWiki page is saved.

This issue came up 4 times out of 100 reviewed diffs, and accounted for ⅔ of problematic diffs on the English Wikipedia this week ( T94767#1225878 ). I see this being a possible point of contention during a wider roll-out.

Based on those numbers, I'm re-nominating this issue as a blocker for further discussion.

It's still happening: https://en.wikipedia.org/w/index.php?diff=660662487&oldid=657477479 The original had only one space between paragraphs, but I usually add two in wikitext ("English spacing"), so there may have been two spaces at the time that I hit return to split the paragraphs.

VisualEditor now strips leading whitespace by design, so this task has become obsolete. Closing.

Even on Office wiki? If not, I have a diff from June 12th about that.

Even on Office wiki? If not, I have a diff from June 12th about that.

I had the same question earlier today, and @Jdforrester-WMF said it might be related to JavaScript that was cached in the user's browser. It may take a few weeks for the issue to completely disappear.

Thanks, Guillaume! I'll be watching.