Page MenuHomePhabricator

<br> tags in certain summaries give the illusion that a page preview is larger than it needs to be
Closed, ResolvedPublic

Description

Steps To Reproduce

  1. Navigate to https://en.wikipedia.beta.wmflabs.org/wiki/Category:Page_Previews which has various <br> tags inserted in the wikitext of the page. # Enable Page Previews
    • Page Previews is currently enabled by default for all logged out users # Hover over the PreviewsAppearAbove/sandbox link # Observe that the preview:
    • Doesn't have a thumbnail
    • Is shown at "full" height (i.e. to fit a thumbnail).

Expected Behaviour

As the preview isn't displaying a thumbnail, it should shrink to fit its text content.

Constrast this:

Screen Shot 2017-12-07 at 12.14.00.png (243×340 px, 29 KB)

With this:

Screen Shot 2017-12-07 at 12.14.09.png (146×338 px, 29 KB)

which is the preview for the link immediately below the one mentioned above.


Browser: Chrome@62.0.3202.94
Operating System: macOS High Sierra (10.13.1) (with root password set!!1)

Event Timeline

also reproducible on Firefox

Jdlrobson subscribed.

It's doing what it's supposed to do. It's not a bug - it's due to the content.

This is not an issue with page previews but the endpoint

The summary produced by the article is:

<p>At a resolution of 1440 x 900 or smaller popups should appear above the following links.\n<br id=\"mwAw\">\n<br id=\"mwBA\">\n<br id=\"mwBQ\">\n<br id=\"mwBg\">\n<br id=\"mwBw\">\n<br id=\"mwCA\">\n<br id=\"mwCQ\">\n<br id=\"mwCg\">\n<br id=\"mwCw\">\n<br id=\"mwDA\">\n<br id=\"mwDQ\">\n<br id=\"mwDg\">\n<br id=\"mwDw\">\n<br id=\"mwEA\">\n<br id=\"mwEQ\">\n<span>With image</span><br id=\"mwEw\">\n<span>PreviewsWithNoImage</span><br id=\"mwFQ\">\n<span>With tall image</span></p>

You'll notice the article has lots of <br> tags (line breaks)
Since they are explicit HTML they are not treated as whitespace so become part of the lead paragraph.

These br tags are followed by text.

We can of course remove those br tags, but they might be important in other contexts. I think this is very unlikely to occur in production so I would caution against adding complexity to the endpoint to deal with it. <br> tags may be necessary in other articles.

Jdlrobson renamed this task from Preview shown at full height when there's no thumbnail to <br> tags in certain summaries give the illusion that a page preview is larger than it needs to be.Dec 7 2017, 6:23 PM
Jdlrobson updated the task description. (Show Details)

I should note, it's possible using css inside Page previews to make <br> tags invisible. However that will result in text being unintentionally squashed:

Screen Shot 2017-12-07 at 10.25.02 AM.png (193×385 px, 38 KB)

@Jdlrobson - good catch. I think we can close this.

So it is shrinking to fit its content but its content is whitespace. I don't mind resolving this as declined as long as we document the behaviour (br tags aren't stripped).

Jdlrobson moved this task from Inbox to Groomed on the User-Jdlrobson board.
Jdlrobson moved this task from Groomed to Tracking on the User-Jdlrobson board.
phuedx claimed this task.

Ta.