Page MenuHomePhabricator

h1 page titles have lots of space before and after
Closed, ResolvedPublic


If I triple-click on a page title (the <h1> heading), in order to copy&paste it, that copied text now includes a preceding and a trailing space. i.e. Wikipedia:Village pump (technical) .
That is new, and should not happen.

Note: the visible highlight only shows the trailing space, but it does also include a preceding space, when pasted.

Reported at WP:VPT (permalink) as:

The last couple of days I have experienced something unfamiliar and unwelcome when copying words on Wikipedia. To be exact, when I, for example, copy a category or article title in order to paste it into an article, the result is like this: " Category:British military personnel killed in World War II ". In other words, all of a sudden I get a space on either side of the copied text. It occurs when I click the titles repeatedly to mark them, and then right-click to copy. When I mark the words by drawing the mouse pointer over the word, I only get an extra space at the end, like so: "Pointer (graphical user interfaces) ". This is something I've never before come across in more than 10 years on the project, and it's pretty annoying. Any reason why this has started happening now? Surely, this is some sort of technical malfunction? Cheers. Manxruler (talk) 18:30, 17 June 2015 (UTC)

Event Timeline

Quiddity created this task.Jun 17 2015, 7:31 PM
Quiddity raised the priority of this task from to Needs Triage.
Quiddity updated the task description. (Show Details)
Quiddity added a subscriber: Quiddity.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 17 2015, 7:31 PM

(not sure if this the correct project to associate)

What browser are you using? I don't seem to be able to reproduce this on Chromium 43 on Ubuntu. On triple-clicking a title, I don't get any leading space, but I do get a trailing newline.

Quiddity updated the task description. (Show Details)Jun 17 2015, 7:37 PM
Quiddity set Security to None.

Reproducible on Firefox 38, Ubuntu. (logged-in and -out)
Not reproducible in Chromium 37, or Opera 12.6

Utar added a subscriber: Utar.Jun 17 2015, 8:17 PM

At cswiki it has been noticed too. It was first reported on 15th June at midday CEST and, according to reports, it seems to be around for one, max for two weeks till now.

On Ubuntu 14.04, reproducible in Firefox 38 and not reproducible in Chrome 43 for me. Logged-iness doesn't seem to have any effect.

Update from enwiki:

The html source of Example says:
<h1 id="firstHeading" class="firstHeading" lang="en">
        Example                 </h1>

That's a lot of whitespace. It varies how browsers treat it when copy-pasting the heading. PrimeHunter (talk) 19:48, 17 June 2015 (UTC)

Main Page snapshots are stored many times daily at*/
CSS hides the heading at
but it's still in the html source.
The snapshots show the whitespace was added June 11.
1.26wmf9 was deployed to the English Wikipedia that day.

Aklapper triaged this task as High priority.Jun 17 2015, 9:06 PM
Aklapper added a project: Regression.
Aklapper renamed this task from h1 page titles have a space before and after to h1 page titles have lots of space before and after.Jun 17 2015, 9:23 PM
Aklapper added a project: MediaWiki-Parser.
TheDJ added a subscriber: TheDJ.Jun 17 2015, 10:06 PM

auch, you can't arbitrarily add newlines into the outputted html... HTML and more importantly, Tidy, is not as whitespace agnostic as people often assume it to be.

Hmm. For some reason I didn't notice that I was introducing that much whitespace into the HTML output. Really sorry. :/

Unfortunately, that patch cannot just be reverted, because jenkins will fail tests again. (I suppose a force-merge is possible?) It would require also require a revert of

I see two quick, both hacky solutions.
One, replace the whitespace with an HTML comment. Something like:


While this should solve the issue, it would pollute the HTML output.

The other, probably better solution is to use @codingStandardsIgnoreStart and @codingStandardsIgnoreEnd php comments around those lines. Will submit a patch for this in a couple of minutes.

Change 219063 had a related patch set uploaded (by Polybuildr):
Remove superfluous whitespace from HTML output

Updated patch set to use @TheDJ's suggestion.

    $this->html( 'title' )

Did similar things to the other 2 changes made in VectorTemplate.php in that patch. Should fix the regression.

Change 219063 merged by jenkins-bot:
Remove superfluous whitespace from HTML output

TheDJ closed this task as Resolved.Jun 17 2015, 11:02 PM
TheDJ claimed this task.

Might be nice to backport this? We could still put it in evening SWAT. I can't promise I'll be available to oversee the deployment myself, though (but anyone can do it).

matmarex reassigned this task from TheDJ to polybuildr.Jun 18 2015, 4:13 PM

Change 219278 had a related patch set uploaded (by Polybuildr):
Remove superfluous whitespace from HTML output

Change 219278 merged by jenkins-bot:
Remove superfluous whitespace from HTML output

Change 219283 had a related patch set uploaded (by EBernhardson):
Remove superfluous whitespace from HTML output

Change 219283 merged by jenkins-bot:
Remove superfluous whitespace from HTML output

The patch was successfully backported to 1.26wmf9 and 1.26wmf10 in the Thursday evening SWAT window.