Page MenuHomePhabricator

Live preview doesn't work with Vector 2022 skin
Closed, ResolvedPublicBUG REPORT

Description

The live preview feature when enabled

Screen Shot 2022-02-02 at 2.43.53 PM.png (322×816 px, 35 KB)

makes various assumptions about the HTML of the page
when I edit https://fr.wikipedia.org/w/index.php?title=Utilisateur:Jon_(WMF)/draft&action=edit:
Screen Shot 2022-02-02 at 2.44.33 PM.png (1×2 px, 294 KB)

This results in the max width applying twice.

QA steps

QA in production.

Developer notes

Looking at https://phabricator.wikimedia.org/source/mediawiki/browse/master/resources/src/mediawiki.action/mediawiki.action.edit.preview.js$44 it makes all sorts of assumptions about the HTML, for example how indicators and categories apply.

On the short term this feature should probably not be loaded on modern Vector:
https://gerrit.wikimedia.org/g/mediawiki/core/+/55a2f2be4da70298e45cdc605059ca6e8753fe5d/includes/EditPage.php#2637

On long term, we should avoid making all these brittle assumptions about the HTML and add a proper API for making such changes.

Event Timeline

Same issue encountered here, the feature was working well yesterday (2 Feb 2022) but became broken today. Please rollback the changes, it isn't ready for 2010 wikitext editor yet.

Here https://upload.wikimedia.org/wikipedia/commons/2/2e/Vector-2022-preview-problem.webp is an recording of how the function looks like now.

it makes all sorts of assumptions about the HTML, for example how indicators and categories apply.

It does, but that is not why it is failing so horridly. It is because the preview loads vector styles, because content varies on skin (See also T130632). And remember how the JS is lying about the skin that it is using???

the parse API call has a useskin: mw.config.get('skin') and this inadvertently now loads the CSS for the original Vector skin.

Thanks for the added context @TheDJ. So yeh looks like that was a bad idea on my part. I was hoping to keep compatibility with gadgets checking mw.config.get('skin') but I hadn't considered it might be passed to the API. Will post patch(es).

Change 753193 had a related patch set uploaded (by Jdlrobson; author: Clare Ming):

[mediawiki/extensions/ContentTranslation@master] Update skin checks with new vector skin key.

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

Change 759531 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Vector@master] Drop skin override

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

Change 753193 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] Update skin checks with new vector skin key.

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

Change 759313 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Vector@wmf/1.38.0-wmf.20] Drop skin override

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

Change 759314 had a related patch set uploaded (by Jdlrobson; author: Clare Ming):

[mediawiki/extensions/ContentTranslation@wmf/1.38.0-wmf.20] Update skin checks with new vector skin key.

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

Change 759313 abandoned by Jdlrobson:

[mediawiki/skins/Vector@wmf/1.38.0-wmf.20] Drop skin override

Reason:

lemme try that again..

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

Change 759313 restored by Jdlrobson:

[mediawiki/skins/Vector@wmf/1.38.0-wmf.20] Drop skin override

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

Change 759314 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@wmf/1.38.0-wmf.20] Update skin checks with new vector skin key.

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

Mentioned in SAL (#wikimedia-operations) [2022-02-03T19:33:15Z] <taavi@deploy1002> Synchronized php-1.38.0-wmf.20/extensions/ContentTranslation/modules/entrypoints/ext.cx.entrypoints.contributionsmenu.js: Backport: [[gerrit:759314|Update skin checks with new vector skin key. (T298916 T300814)]] (duration: 00m 50s)

Change 759313 merged by jenkins-bot:

[mediawiki/skins/Vector@wmf/1.38.0-wmf.20] Drop skin override

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

Mentioned in SAL (#wikimedia-operations) [2022-02-03T20:06:26Z] <taavi@deploy1002> Synchronized php-1.38.0-wmf.20/skins/Vector/skin.json: Backport: [[gerrit:759313|Drop skin override (T300814)]] (1/2) (duration: 00m 49s)

Change 759531 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Drop skin override

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

Mentioned in SAL (#wikimedia-operations) [2022-02-03T20:07:19Z] <taavi@deploy1002> Synchronized php-1.38.0-wmf.20/skins/Vector/includes/Hooks.php: Backport: [[gerrit:759313|Drop skin override (T300814)]] (2/2) (duration: 00m 49s)

Note: live preview makes a lot of assumptions on the styling of legacy vector meaning this is still fragile and we should review when discussing the upcoming navigational changes

bwang removed bwang as the assignee of this task.Feb 22 2022, 6:12 PM
bwang subscribed.

lgtm - went thru QA steps to confirm