Page MenuHomePhabricator

In VisualEditor, footnote immediately following a period sometimes wraps to new line even though there is space left in the line
Closed, ResolvedPublic1 Story Points


It's hard to explain, so I kindly refer you to the below screenshot. It's not plausible that footnote [36] wraps to a new line. For one, typographically speaking, it shouldn't be separated from the preceding period. On top of that, there is a considerable amount of space left in the first line (look at how wide the second line and the other lines on the page are), so I don't understand why it wraps in first place.

For your convenience, here is the wikitext of the affected paragraph:

Spanien war früh als möglicher Kandidat für ein OMT-Programm im Gespräch, doch hat sich diese Erwartung vieler Investoren immer wieder als falsch erwiesen.<ref>Vgl. Robin Wigglesworth und Mary Watkins: [ ''Spain escapes aid but doubts remain.''] In: ''Financial Times ('' 21. Januar 2013, abgerufen am 18. April 2015.</ref> Ministerpräsident [[Mariano Rajoy]] bekräftigte im Januar 2013, dass er „momentan“ keine Notwendigkeit für ein Programm sehe, die Option jedoch bestehe und es absurd wäre, sie auf alle Zeiten auszuschließen.<ref>Vgl. Lionel Barber, Tobias Buck und Michael Steen: [ ''Spain calls on Germany to boost growth.''] In: ''Financial Times ('' 15. Januar 2013, abgerufen am 18. April 2014.</ref>

Event Timeline

pajz created this task.Apr 18 2015, 8:25 PM
pajz raised the priority of this task from to Needs Triage.
pajz updated the task description. (Show Details)
pajz added a project: VisualEditor.
pajz added a subscriber: pajz.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 18 2015, 8:25 PM

This is because VisualEditor renders a non-breaking space between the "[2]" and "Ministerpräsident". Some regular spaces in input have to be converted this way to render correctly in HTML (leading and trailing spaces in a paragraph, multiple spaces), but in this case we're too eager.

I spend a while working on this and it's nastier than I thought.

I wrote a simple patch ( that works correctly (as far as I can tell), but browsers are also over-eager in inserting &nbsp; when typing spaces at the beginning and end of text nodes. Doing this would make our rendering different from browser's one, causing text to shift around when re-rendering nodes (which would replace some nbsps with spaces).

We'd need to handle typing space at beginning/end programatically, at which point this becomes probably not worth it (and I have no idea how to do that).

Playground: (type spaces around the image, observe browser console).

matmarex set Security to None.
Neil_P._Quinn_WMF triaged this task as Normal priority.May 19 2015, 4:13 PM
Neil_P._Quinn_WMF moved this task from To Triage to Freezer on the VisualEditor board.

Change 255931 had a related patch set uploaded (by Bartosz Dziewoński):
Use white-space: pre-wrap instead of using &nbsp; for spaces

Jdforrester-WMF edited a custom field.

Change 255931 merged by jenkins-bot:
Use white-space: pre-wrap instead of using &nbsp; for spaces