Page MenuHomePhabricator

TemplateStyles not applied when loading VE/NWE
Closed, ResolvedPublic

Description

As suggested in T212085, here a new task for this problem.

I was wondering if TemplateStyles could be applied also while loading the VE/NWE (those approx. 2 seconds after clicking the edit button). It is confusing, to say the least, seeing the page broken, even if it is only for a few seconds.

Event Timeline

I think this is caused by how we "disable" the existing style tags on the page when loading the editor (we do this so that the styles no longer apply if you remove the template that adds them in the editor).

Video for reference – note how the styling of the quote box in bottom-left flickers while the editor is loading, and then again while it is closing:
(recorded on https://en.wikipedia.org/wiki/Animism#Theories)

We probably disable/enable the styles at the wrong time during the editor setup/teardown.

Change 602724 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] Toggle TemplateStyles at a better time during (de)activation to avoid flashing

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

Change 602724 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Toggle TemplateStyles at a better time during (de)activation to avoid flashing

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

I can confirm that this works correctly now, testing on the same page as before (https://en.wikipedia.org/wiki/Animism#Old_animism) and looking at the quote box:

Before (T254518#6196300)After